跳转至主内容
Version: 2.0.0-beta.15

📦 plugin-sitemap

This plugin creates sitemaps for your site so that search engine crawlers can crawl your site more accurately.

production only

This plugin is always inactive in development and only active in production because it works on the build output.

安装

npm install --save @docusaurus/plugin-sitemap
tip

若您已安装 @docusaurus/preset-classic,您则并不需要安装此依赖。

您可以通过 预设选项 配置此插件。

配置

Accepted fields:

NameTypeDefaultDescription
changefreqstring'weekly'See sitemap docs
prioritynumber0.5See sitemap docs
信息

This plugin also respects some site config:

  • noIndex: results in no sitemap generated
  • trailingSlash: determines if the URLs in the sitemap have trailing slashes

示例配置

You can configure this plugin through preset options or plugin options.

tip

Most Docusaurus users configure this plugin through the preset options.

If you use a preset, configure this plugin through the preset options:

docusaurus.config.js
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
sitemap: {
changefreq: 'weekly',
priority: 0.5,
},
},
],
],
};