Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 56 additions & 15 deletions src/content/docs/en/guides/integrations-guide/sitemap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ export default defineConfig({
});
```

### filter
### `filter`

<p>

**Type:** `(page: string) => boolean`
</p>

All pages are included in your sitemap by default. By adding a custom `filter` function, you can filter included pages by URL.

Expand Down Expand Up @@ -233,7 +238,12 @@ export default defineConfig({
});
```

### customPages
### `customPages`

<p>

**Type:** `string[]`
</p>

An array of externally-generated pages to be included in the generated sitemap file.

Expand All @@ -253,7 +263,7 @@ export default defineConfig({
});
```

### customSitemaps
### `customSitemaps`

<p>

Expand All @@ -280,7 +290,13 @@ export default defineConfig({
});
```

### entryLimit
### `entryLimit`

<p>

**Type:** `number`<br />
**Default:** `45000`
</p>

The maximum number entries per sitemap file. The default value is 45000. A sitemap index and multiple sitemaps are created if you have more entries. See this [explanation of splitting up a large sitemap](https://developers.google.com/search/docs/advanced/sitemaps/large-sitemaps).

Expand All @@ -298,7 +314,13 @@ export default defineConfig({
});
```

### changefreq, lastmod, and priority
### `changefreq`, `lastmod`, and `priority`

<p>

**Type:** `{ changefreq?: ChangeFreq; lastmod?: Date; priority?: number; }`
<Since v="0.2.0" pkg="@astrojs/sitemap" />
</p>

These options correspond to the `<changefreq>`, `<lastmod>`, and `<priority>` tags in the [Sitemap XML specification.](https://www.sitemaps.org/protocol.html)

Expand All @@ -324,7 +346,12 @@ export default defineConfig({
});
```

### serialize
### `serialize`

<p>

**Type:** `(item: SitemapItem) => SitemapItem | Promise<SitemapItem | undefined> | undefined`
</p>

A function called for each sitemap entry just before writing to a disk. This function can be asynchronous.

Expand Down Expand Up @@ -368,18 +395,19 @@ export default defineConfig({
});
```

### i18n
### `i18n`

To localize a sitemap, pass an object to this `i18n` option.
<p>

This object has two required properties:
**Type:** `{ defaultLocale: string; locales: Record<string, string>; }`
</p>

* `defaultLocale`: `String`. Its value must exist as one of `locales` keys.
* `locales`: `Record<String, String>`, key/value - pairs. The key is used to look for a locale part in a page path. The value is a language attribute, only English alphabet and hyphen allowed.
To [localize a sitemap](https://developers.google.com/search/docs/advanced/crawling/localized-versions#all-method-guidelines), pass an object to this `i18n` option.

[Read more about language attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang).
This object has two required properties:

[Read more about localization](https://developers.google.com/search/docs/advanced/crawling/localized-versions#all-method-guidelines).
* `defaultLocale`: Its value must exist as one of `locales` keys.
* `locales`: key/value - pairs. The key is used to look for a locale part in a page path. The value is a [language attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang), only English alphabet and hyphen allowed.

```js title="astro.config.mjs" ins={8-15}
import { defineConfig } from 'astro/config';
Expand Down Expand Up @@ -433,7 +461,13 @@ The resulting sitemap looks like this:
...
```

### xslURL
### `xslURL`

<p>

**Type:** `string`<br />
<Since v="3.2.0" pkg="@astrojs/sitemap" />
</p>

The URL of an XSL stylesheet to style and prettify your sitemap.

Expand All @@ -453,7 +487,14 @@ export default defineConfig({
});
```

### filenameBase
### `filenameBase`

<p>

**Type:** `string`<br />
**Default:** `sitemap`<br />
<Since v="3.4.0" pkg="@astrojs/sitemap" />
</p>

The name prefix string used when generating the sitemap XML files. The default value is `sitemap`.

Expand Down