Skip to content

Commit 7642316

Browse files
fix(sitemap): add API references to config options (#12304)
Co-authored-by: sarah11918 <[email protected]>
1 parent 3e44105 commit 7642316

File tree

1 file changed

+56
-15
lines changed
  • src/content/docs/en/guides/integrations-guide

1 file changed

+56
-15
lines changed

src/content/docs/en/guides/integrations-guide/sitemap.mdx

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ export default defineConfig({
193193
});
194194
```
195195

196-
### filter
196+
### `filter`
197+
198+
<p>
199+
200+
**Type:** `(page: string) => boolean`
201+
</p>
197202

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

@@ -233,7 +238,12 @@ export default defineConfig({
233238
});
234239
```
235240

236-
### customPages
241+
### `customPages`
242+
243+
<p>
244+
245+
**Type:** `string[]`
246+
</p>
237247

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

@@ -253,7 +263,7 @@ export default defineConfig({
253263
});
254264
```
255265

256-
### customSitemaps
266+
### `customSitemaps`
257267

258268
<p>
259269

@@ -280,7 +290,13 @@ export default defineConfig({
280290
});
281291
```
282292

283-
### entryLimit
293+
### `entryLimit`
294+
295+
<p>
296+
297+
**Type:** `number`<br />
298+
**Default:** `45000`
299+
</p>
284300

285301
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).
286302

@@ -298,7 +314,13 @@ export default defineConfig({
298314
});
299315
```
300316

301-
### changefreq, lastmod, and priority
317+
### `changefreq`, `lastmod`, and `priority`
318+
319+
<p>
320+
321+
**Type:** `{ changefreq?: ChangeFreq; lastmod?: Date; priority?: number; }`
322+
<Since v="0.2.0" pkg="@astrojs/sitemap" />
323+
</p>
302324

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

@@ -324,7 +346,12 @@ export default defineConfig({
324346
});
325347
```
326348

327-
### serialize
349+
### `serialize`
350+
351+
<p>
352+
353+
**Type:** `(item: SitemapItem) => SitemapItem | Promise<SitemapItem | undefined> | undefined`
354+
</p>
328355

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

@@ -368,18 +395,19 @@ export default defineConfig({
368395
});
369396
```
370397

371-
### i18n
398+
### `i18n`
372399

373-
To localize a sitemap, pass an object to this `i18n` option.
400+
<p>
374401

375-
This object has two required properties:
402+
**Type:** `{ defaultLocale: string; locales: Record<string, string>; }`
403+
</p>
376404

377-
* `defaultLocale`: `String`. Its value must exist as one of `locales` keys.
378-
* `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.
405+
To [localize a sitemap](https://developers.google.com/search/docs/advanced/crawling/localized-versions#all-method-guidelines), pass an object to this `i18n` option.
379406

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

382-
[Read more about localization](https://developers.google.com/search/docs/advanced/crawling/localized-versions#all-method-guidelines).
409+
* `defaultLocale`: Its value must exist as one of `locales` keys.
410+
* `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.
383411

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

436-
### xslURL
464+
### `xslURL`
465+
466+
<p>
467+
468+
**Type:** `string`<br />
469+
<Since v="3.2.0" pkg="@astrojs/sitemap" />
470+
</p>
437471

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

@@ -453,7 +487,14 @@ export default defineConfig({
453487
});
454488
```
455489

456-
### filenameBase
490+
### `filenameBase`
491+
492+
<p>
493+
494+
**Type:** `string`<br />
495+
**Default:** `sitemap`<br />
496+
<Since v="3.4.0" pkg="@astrojs/sitemap" />
497+
</p>
457498

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

0 commit comments

Comments
 (0)