📦 plugin-sitemap
这个插件会为你的站点创建一个站点地图,以便搜索引擎的爬虫能够更准确地爬取你的网站。
production only
This plugin is always inactive in development and only active in production because it works on the build output.
Installation
- npm
- Yarn
- pnpm
npm install --save @docusaurus/plugin-sitemap
yarn add @docusaurus/plugin-sitemap
pnpm add @docusaurus/plugin-sitemap
提示
If you use the preset @docusaurus/preset-classic
, you don't need to install this plugin as a dependency.
You can configure this plugin through the preset options.
Configuration
接受的字段:
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
lastmod | 'date' | 'datetime' | null | null | date is YYYY-MM-DD. datetime is a ISO 8601 datetime. null is disabled. See sitemap docs. |
changefreq | string | null | 'weekly' | See sitemap docs |
priority | number | null | 0.5 | See sitemap docs |
ignorePatterns | string[] | [] | 一列 glob 模式。匹配成功的路径不会出现在站点地图中。 注意你可能要在这里加上 base URL。 |
filename | string | sitemap.xml | 创建的站点地图的路径,相对于输出目录。 如果你有两个插件实例输出两个文件,会很有用。 |
createSitemapItems | CreateSitemapItemsFn | undefined | undefined | An optional function which can be used to transform and / or filter the items in the sitemap. |