2020-11-30 08:07:08 -05:00
---
2021-11-10 01:08:50 -05:00
sidebar_position: 10
2020-11-30 08:07:08 -05:00
id: plugin-sitemap
title: '📦 plugin-sitemap'
slug: '/api/plugins/@docusaurus/plugin-sitemap'
---
2021-12-28 08:23:27 -05:00
import APITable from '@site/src/components/APITable';
This plugin creates sitemaps for your site so that search engine crawlers can crawl your site more accurately.
:::caution production only
This plugin is always inactive in development and **only active in production** because it works on the build output.
:::
2020-11-30 08:07:08 -05:00
2021-03-19 06:00:41 -04:00
## Installation {#installation}
2020-11-30 08:07:08 -05:00
```bash npm2yarn
npm install --save @docusaurus/plugin -sitemap
```
:::tip
2021-12-28 08:23:27 -05:00
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 ](#ex-config-preset ).
2020-11-30 08:07:08 -05:00
:::
2021-03-19 06:00:41 -04:00
## Configuration {#configuration}
2020-11-30 08:07:08 -05:00
2021-12-28 08:23:27 -05:00
Accepted fields:
< APITable >
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `changefreq` | `string` | `'weekly'` | See [sitemap docs ](https://www.sitemaps.org/protocol.html#xmlTagDefinitions ) |
| `priority` | `number` | `0.5` | See [sitemap docs ](https://www.sitemaps.org/protocol.html#xmlTagDefinitions ) |
2022-04-06 09:44:07 -04:00
| `ignorePatterns` | `string[]` | `[]` | A list of glob patterns; matching route paths will be filtered from the sitemap. Note that you may need to include the base URL in here. |
2021-12-28 08:23:27 -05:00
< / APITable >
2022-01-05 11:56:17 -05:00
:::info
This plugin also respects some site config:
2022-05-03 01:57:19 -04:00
- [`noIndex` ](../docusaurus.config.js.md#noIndex ): results in no sitemap generated
- [`trailingSlash` ](../docusaurus.config.js.md#trailingSlash ): determines if the URLs in the sitemap have trailing slashes
2022-01-05 11:56:17 -05:00
:::
2021-12-28 08:23:27 -05:00
### Example configuration {#ex-config}
You can configure this plugin through preset options or plugin options.
:::tip
Most Docusaurus users configure this plugin through the preset options.
:::
```js config-tabs
2022-01-06 06:31:58 -05:00
// Preset Options: sitemap
// Plugin Options: @docusaurus/plugin -sitemap
2021-12-28 08:23:27 -05:00
const config = {
changefreq: 'weekly',
priority: 0.5,
2022-04-06 09:44:07 -04:00
ignorePatterns: ['/tags/**'],
2020-11-30 08:07:08 -05:00
};
```
2022-01-28 04:11:09 -05:00
You can find your sitemap at `/sitemap.xml` .