From c7b58e33837e9288ae584d1904b1ec06331311aa Mon Sep 17 00:00:00 2001 From: ktym4a Date: Tue, 13 Feb 2024 22:24:43 +0700 Subject: [PATCH 1/2] Add prefix option to change sitemap filename --- .../en/guides/integrations-guide/sitemap.mdx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/content/docs/en/guides/integrations-guide/sitemap.mdx b/src/content/docs/en/guides/integrations-guide/sitemap.mdx index 8d49dec996c12..adefb7c9234b7 100644 --- a/src/content/docs/en/guides/integrations-guide/sitemap.mdx +++ b/src/content/docs/en/guides/integrations-guide/sitemap.mdx @@ -392,6 +392,24 @@ The resulting sitemap looks like this: ... ``` +### prefix + +By default `sitemap-index.xml` and `sitemap-*.xml` are created in the output directory. By setting `prefix`, You can change the filename. + +```js title="astro.config.mjs" ins={8} +import { defineConfig } from 'astro/config'; +import sitemap from '@astrojs/sitemap'; + +export default defineConfig({ + site: 'https://stargazers.club', + integrations: [ + sitemap({ + prefix: 'astrosite-', // output files will be `astrosite-index.xml` and `astrosite-*.xml`. + }), + ], +}); +``` + ## Examples * The official Astro website uses Astro Sitemap to generate [its sitemap](https://astro.build/sitemap-index.xml). From 46cce9a861cd028bf2aec8fb7c8eccd8e74915c0 Mon Sep 17 00:00:00 2001 From: ktym4a Date: Wed, 14 Feb 2024 03:50:49 +0700 Subject: [PATCH 2/2] Update src/content/docs/en/guides/integrations-guide/sitemap.mdx Co-authored-by: Sarah Rainsberger --- src/content/docs/en/guides/integrations-guide/sitemap.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/en/guides/integrations-guide/sitemap.mdx b/src/content/docs/en/guides/integrations-guide/sitemap.mdx index adefb7c9234b7..c0ff3c922e479 100644 --- a/src/content/docs/en/guides/integrations-guide/sitemap.mdx +++ b/src/content/docs/en/guides/integrations-guide/sitemap.mdx @@ -394,7 +394,7 @@ The resulting sitemap looks like this: ### prefix -By default `sitemap-index.xml` and `sitemap-*.xml` are created in the output directory. By setting `prefix`, You can change the filename. +By default, files named `sitemap-index.xml` and `sitemap-*.xml` are created in the output directory when you run `astro build`. You can change these filenames by adding a value for `prefix` in your `sitemap()` configuration. ```js title="astro.config.mjs" ins={8} import { defineConfig } from 'astro/config';