mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-12 15:52:39 +02:00
Merge branch 'main' into ozaki/showcase
This commit is contained in:
commit
01657b0744
249 changed files with 24910 additions and 3445 deletions
|
@ -44,11 +44,24 @@ Accepted fields:
|
|||
| `priority` | `number \| null` | `0.5` | See [sitemap docs](https://www.sitemaps.org/protocol.html#xmlTagDefinitions) |
|
||||
| `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. |
|
||||
| `filename` | `string` | `sitemap.xml` | The path to the created sitemap file, relative to the output directory. Useful if you have two plugin instances outputting two files. |
|
||||
| `createSitemapItems` | <code>[CreateSitemapItemsFn](#CreateSitemapItemsFn) \| undefined</code> | `undefined` | An optional function which can be used to transform and / or filter the items in the sitemap. |
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
### Types {#types}
|
||||
|
||||
#### `CreateSitemapItemsFn` {#CreateSitemapItemsFn}
|
||||
|
||||
```ts
|
||||
type CreateSitemapItemsFn = (params: {
|
||||
siteConfig: DocusaurusConfig;
|
||||
routes: RouteConfig[];
|
||||
defaultCreateSitemapItems: CreateSitemapItemsFn;
|
||||
}) => Promise<SitemapItem[]>;
|
||||
```
|
||||
|
||||
:::info
|
||||
|
||||
This plugin also respects some site config:
|
||||
|
@ -86,6 +99,11 @@ const config = {
|
|||
priority: 0.5,
|
||||
ignorePatterns: ['/tags/**'],
|
||||
filename: 'sitemap.xml',
|
||||
createSitemapItems: async (params) => {
|
||||
const {defaultCreateSitemapItems, ...rest} = params;
|
||||
const items = await defaultCreateSitemapItems(rest);
|
||||
return items.filter((item) => !item.url.includes('/page/'));
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue