@mr-hope/vuepress-plugin-sitemap
Advanced tools
Comparing version 1.24.0 to 1.25.0
@@ -18,3 +18,3 @@ "use strict"; | ||
const generatePageMap = (siteData, base, options) => { | ||
const { changefreq = "daily", exclude = [], dateFormatter = (page) => page.updateTimeStamp ? new Date(page.updateTimeStamp).toISOString() : "", } = options; | ||
const { changefreq = "daily", exclude = ["/404.html"], dateFormatter = (page) => page.updateTimeStamp ? new Date(page.updateTimeStamp).toISOString() : "", } = options; | ||
const { pages, locales = {} } = siteData; | ||
@@ -50,3 +50,5 @@ // Sort the locale keys in reverse order so that longer locales, such as '/en/', match before the default '/' | ||
})); | ||
pagesMap.set(page.path, Object.assign(Object.assign({}, frontmatterOptions), { changefreq: frontmatterOptions.changefreq || changefreq, lastmod: lastmodifyTime, links })); | ||
const sitemapInfo = Object.assign(Object.assign({ changefreq, | ||
links }, (lastmodifyTime ? { lastmod: lastmodifyTime } : {})), frontmatterOptions); | ||
pagesMap.set(page.path, sitemapInfo); | ||
}); | ||
@@ -58,6 +60,5 @@ return pagesMap; | ||
const siteData = context.getSiteData(); | ||
const { hostname, urls = [], outFile = "sitemap.xml", xslUrl, exclude = [], xmlNameSpace: xmlns, } = options; | ||
const { hostname, urls = [], outFile = "sitemap.xml", exclude = [], xmlNameSpace: xmlns, } = options; | ||
const sitemap = new sitemap_1.SitemapStream({ | ||
hostname, | ||
xslUrl, | ||
xmlns, | ||
@@ -64,0 +65,0 @@ }); |
/* eslint-disable @typescript-eslint/naming-convention */ | ||
import type { PageComputed } from "@mr-hope/vuepress-types"; | ||
interface SitemapImageOption { | ||
/** The URL of the image. */ | ||
url: string; | ||
/** The caption of the image. */ | ||
caption?: string; | ||
/** The title of the image. */ | ||
title?: string; | ||
/** The geographic location of the image. */ | ||
geoLocation?: string; | ||
/** A URL to the license of the image. */ | ||
license?: string; | ||
} | ||
interface SitemapVideoOption { | ||
/** A URL pointing to the video thumbnail image file */ | ||
thumbnail_loc: string; | ||
/** The title of the video. */ | ||
title: string; | ||
/** A description of the video. Maximum 2048 characters. */ | ||
description: string; | ||
/** | ||
* A URL pointing to the actual video media file. Should be one of the supported formats. | ||
* HTML is not a supported format. Flash is allowed, but no longer supported on most mobile platforms, | ||
* and so may be indexed less well. Must not be the same as the <loc> URL. | ||
*/ | ||
content_loc?: string; | ||
/** | ||
* A URL pointing to a player for a specific video. Usually this is the information | ||
* in the src element of an <embed> tag. Must not be the same as the <loc> URL | ||
*/ | ||
player_loc?: string; | ||
/** a string the search engine can append as a query param to enable automatic playback */ | ||
"player_loc:autoplay"?: string; | ||
/** duration of video in seconds */ | ||
duration?: number; | ||
/** The date after which the video will no longer be available */ | ||
expiration_date?: string; | ||
/** The number of times the video has been viewed. */ | ||
view_count: number; | ||
/** The date the video was first published, in W3C format. */ | ||
publication_date?: string; | ||
/** | ||
* A short description of the broad category that the video belongs to. | ||
* This is a string no longer than 256 characters. | ||
*/ | ||
category?: string; | ||
/** Whether to show or hide your video in search results from specific countries. */ | ||
restriction?: string; | ||
"restriction:relationship"?: string; | ||
/** The price to download or view the video. Omit this tag for free videos. */ | ||
price?: string; | ||
/** Specifies the resolution of the purchased version. Supported values are hd and sd. */ | ||
"price:resolution"?: string; | ||
/** Specifies the currency in ISO 4217 format. */ | ||
"price:currency"?: string; | ||
/** Specifies the purchase option. Supported values are rent and own. */ | ||
"price:type"?: string; | ||
/** The video uploader’s name. Only one video:uploader is allowed per video. String value, max 255 characters. */ | ||
uploader?: string; | ||
/** Whether to show or hide your video in search results on specified platform types. This is a list of space-delimited platform types. See https://support.google.com/webmasters/answer/80471?hl=en&ref_topic=4581190 for more detail */ | ||
platform?: string; | ||
"platform:relationship"?: "Allow" | "Deny"; | ||
id?: string; | ||
/** | ||
* An arbitrary string tag describing the video. | ||
* Tags are generally very short descriptions of key concepts associated with a video or piece of content. | ||
*/ | ||
tag?: string[]; | ||
/** The rating of the video. Supported values are float numbers */ | ||
rating?: number; | ||
family_friendly?: "YES" | "NO"; | ||
/** Indicates whether a subscription (either paid or free) is required to view the video. */ | ||
requires_subscription?: "YES" | "NO"; | ||
/** Indicates whether the video is a live stream. Supported values are yes or no. */ | ||
live?: "YES" | "NO"; | ||
} | ||
export interface SitemapLinkOption { | ||
lang: string; | ||
url: string; | ||
} | ||
export interface SitemapFrontmatterOption { | ||
/** | ||
* 更新频率 | ||
* | ||
* Update Frequency | ||
*/ | ||
changefreq?: | ||
| "always" | ||
| "hourly" | ||
| "daily" | ||
| "weekly" | ||
| "monthly" | ||
| "yearly" | ||
| "never"; | ||
/** | ||
* 是否不包含此页面 | ||
* | ||
* Whether to exclude this page from sitemap | ||
*/ | ||
exclude?: boolean; | ||
/** | ||
* 页面优先级,0.0 - 1.0 | ||
* | ||
* Priority of this page, supports 0.0 -1.0 | ||
*/ | ||
priority?: number; | ||
/** | ||
* 图片配置 | ||
* | ||
* Image config | ||
*/ | ||
img?: SitemapImageOption[]; | ||
/** | ||
* 视频配置 | ||
* | ||
* Video config | ||
*/ | ||
video?: SitemapVideoOption[]; | ||
} | ||
/** Sitemap 配置选项 */ | ||
export interface SitemapOptions { | ||
/** | ||
* 网站域名 | ||
* | ||
* domain which to be deployed to | ||
*/ | ||
hostname: string; | ||
/** | ||
* 需要额外包含的网址 | ||
* | ||
* Extra urls to be included | ||
*/ | ||
urls?: string[]; | ||
/** | ||
* 不被收录的页面 | ||
* | ||
* Urls to be excluded | ||
*/ | ||
exclude?: string[]; | ||
/** | ||
* 输出的文件名 | ||
* | ||
* Output file name | ||
* | ||
* @default 'sitemap.xml' | ||
*/ | ||
outFile?: string; | ||
/** | ||
* 页面默认更新频率 | ||
* | ||
* Page default update frequency | ||
* | ||
* @default "daily" | ||
*/ | ||
changefreq?: | ||
| "always" | ||
| "hourly" | ||
| "daily" | ||
| "weekly" | ||
| "monthly" | ||
| "yearly" | ||
| "never"; | ||
/** | ||
* Date format function | ||
*/ | ||
dateFormatter?: ($page: PageComputed) => string; | ||
xslUrl?: string; | ||
/** XML namespaces to turn on - all by default */ | ||
xmlNameSpace?: { | ||
news: boolean; | ||
video: boolean; | ||
xhtml: boolean; | ||
image: boolean; | ||
custom?: string[]; | ||
}; | ||
} | ||
export * from "./frontmatter"; | ||
export * from "./options"; | ||
export * from "./sitemap"; |
{ | ||
"name": "@mr-hope/vuepress-plugin-sitemap", | ||
"version": "1.24.0", | ||
"version": "1.25.0", | ||
"description": "Sitemap plugin for vuepress", | ||
@@ -41,3 +41,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "7914e584fb47d76bd4d739cf99f824def8a6068d" | ||
"gitHead": "d2f49ef3479ee161557b360367397d2d2c95ecaa" | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
20796
13
383
1