From 4f53f16579041e0321fb9ac1af72ff572ad9d25a Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Tue, 29 Apr 2025 11:14:10 +0530 Subject: [PATCH 1/6] docs(en/sitemap.mdx): describe customSitemaps --- .../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 b8c30ea620447..2b86555502647 100644 --- a/src/content/docs/en/guides/integrations-guide/sitemap.mdx +++ b/src/content/docs/en/guides/integrations-guide/sitemap.mdx @@ -250,6 +250,24 @@ export default defineConfig({ }); ``` +### customSitemaps + +In some cases, you might have a section on your site that *isn't* created by Astro. If that section has it's own sitemap and you'd like to include it in the `sitemap-index.xml` file created by Astro, you can use this option. + +```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({ + customSitemaps: ['https://stargazers.club/blog/sitemap.xml', 'https://stargazers.club/shop/sitemap.xml'], + }), + ], +}); +``` + ### entryLimit 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). From 7d8094b42319fd65f9a9a18bb4d5195136ec1a24 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Wed, 18 Jun 2025 01:58:59 +0530 Subject: [PATCH 2/6] fix: grammar Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com> --- 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 2b86555502647..f8dd373e24920 100644 --- a/src/content/docs/en/guides/integrations-guide/sitemap.mdx +++ b/src/content/docs/en/guides/integrations-guide/sitemap.mdx @@ -252,7 +252,7 @@ export default defineConfig({ ### customSitemaps -In some cases, you might have a section on your site that *isn't* created by Astro. If that section has it's own sitemap and you'd like to include it in the `sitemap-index.xml` file created by Astro, you can use this option. +In some cases, you might have a section on your site that *isn't* created by Astro. If that section has its own sitemap and you'd like to include it in the `sitemap-index.xml` file created by Astro, you can use this option. ```js title="astro.config.mjs" ins={8} import { defineConfig } from 'astro/config'; From 2fb2dfd2ca3c542cb74115677a00805d313dd811 Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Fri, 25 Jul 2025 14:03:59 -0300 Subject: [PATCH 3/6] sarah light style edit, plus update url to example.com page-wide --- .../en/guides/integrations-guide/sitemap.mdx | 91 +++++++++++-------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/src/content/docs/en/guides/integrations-guide/sitemap.mdx b/src/content/docs/en/guides/integrations-guide/sitemap.mdx index 592281671a823..846689d65eb45 100644 --- a/src/content/docs/en/guides/integrations-guide/sitemap.mdx +++ b/src/content/docs/en/guides/integrations-guide/sitemap.mdx @@ -93,7 +93,7 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [sitemap()], // ... }); @@ -112,7 +112,7 @@ For extremely large sites, there may also be additional numbered files like `sit - https://stargazers.club/sitemap-0.xml + https://example.com/sitemap-0.xml ``` @@ -121,10 +121,10 @@ For extremely large sites, there may also be additional numbered files like `sit - https://stargazers.club/ + https://example.com/ - https://stargazers.club/second-page/ + https://example.com/second-page/ ``` @@ -201,10 +201,10 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ - filter: (page) => page !== 'https://stargazers.club/secret-vip-lounge/', + filter: (page) => page !== 'https://example.com/secret-vip-lounge/', }), ], }); @@ -219,14 +219,14 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ filter: (page) => - page !== 'https://stargazers.club/secret-vip-lounge-1/' && - page !== 'https://stargazers.club/secret-vip-lounge-2/' && - page !== 'https://stargazers.club/secret-vip-lounge-3/' && - page !== 'https://stargazers.club/secret-vip-lounge-4/', + page !== 'https://example.com/secret-vip-lounge-1/' && + page !== 'https://example.com/secret-vip-lounge-2/' && + page !== 'https://example.com/secret-vip-lounge-3/' && + page !== 'https://example.com/secret-vip-lounge-4/', }), ], }); @@ -234,17 +234,19 @@ export default defineConfig({ ### customPages -In some cases, a page might be part of your deployed site but not part of your Astro project. If you'd like to include a page in your sitemap that *isn't* created by Astro, you can use this option. +An array of externally-generated pages to be included in the generated sitemap file. + +Use this option to include pages in your sitemap that are a part of your deployed site but are not created by Astro. ```js title="astro.config.mjs" ins={8} import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ - customPages: ['https://stargazers.club/external-page', 'https://stargazers.club/external-page2'], + customPages: ['https://example.com/external-page1', 'https://example.com/external-page2'], }), ], }); @@ -252,17 +254,26 @@ export default defineConfig({ ### customSitemaps -In some cases, you might have a section on your site that *isn't* created by Astro. If that section has its own sitemap and you'd like to include it in the `sitemap-index.xml` file created by Astro, you can use this option. +

+ +**Type:** `string[]`
+**Default:** `[]`
+ +

+ +An array of externally sitemaps to be included in the `sitemap-index.xml` file along with the generated sitemap entries. + +Use this option to include external sitemaps in the `sitemap-index.xml` file created by Astro for sections of your deployed site that have their own sitemaps not created by Astro. This is helpful when you host multiple services under the same domain. ```js title="astro.config.mjs" ins={8} import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ - customSitemaps: ['https://stargazers.club/blog/sitemap.xml', 'https://stargazers.club/shop/sitemap.xml'], + customSitemaps: ['https://example.com/blog/sitemap.xml', 'https://example.com/shop/sitemap.xml'], }), ], }); @@ -277,7 +288,7 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ entryLimit: 10000, @@ -301,7 +312,7 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ changefreq: 'weekly', @@ -337,7 +348,7 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ serialize(item) { @@ -374,11 +385,11 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ i18n: { - defaultLocale: 'en', // All urls that don't contain `es` or `fr` after `https://stargazers.club/` will be treated as default locale, i.e. `en` + defaultLocale: 'en', // All urls that don't contain `es` or `fr` after `https://example.com/` will be treated as default locale, i.e. `en` locales: { en: 'en-US', // The `defaultLocale` value must present in `locales` keys es: 'es-ES', @@ -395,28 +406,28 @@ The resulting sitemap looks like this: ```xml title="sitemap-0.xml" ... - https://stargazers.club/ - - - + https://example.com/ + + + - https://stargazers.club/es/ - - - + https://example.com/es/ + + + - https://stargazers.club/fr/ - - - + https://example.com/fr/ + + + - https://stargazers.club/es/second-page/ - - - + https://example.com/es/second-page/ + + + ... ``` @@ -452,7 +463,7 @@ import { defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; export default defineConfig({ - site: 'https://stargazers.club', + site: 'https://example.com', integrations: [ sitemap({ filenameBase: 'astronomy-sitemap' @@ -461,7 +472,7 @@ export default defineConfig({ }); ``` -The given configuration will generate sitemap files at `https://stargazers.club/astronomy-sitemap-0.xml` and `https://stargazers.club/astronomy-sitemap-index.xml`. +The given configuration will generate sitemap files at `https://example.com/astronomy-sitemap-0.xml` and `https://example.com/astronomy-sitemap-index.xml`. ## Examples From 5a38307d60e5a16ac44293f2101dc911190b8d59 Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Fri, 25 Jul 2025 14:07:05 -0300 Subject: [PATCH 4/6] import the Since component --- src/content/docs/en/guides/integrations-guide/sitemap.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/docs/en/guides/integrations-guide/sitemap.mdx b/src/content/docs/en/guides/integrations-guide/sitemap.mdx index 846689d65eb45..6387dc823db69 100644 --- a/src/content/docs/en/guides/integrations-guide/sitemap.mdx +++ b/src/content/docs/en/guides/integrations-guide/sitemap.mdx @@ -9,6 +9,7 @@ category: other i18nReady: true --- import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'; +import Since from '~/components/Since.astro'; This **[Astro integration][astro-integration]** generates a sitemap based on your pages when you build your Astro project. From adbc8c58b3f9f4c376a41ded64fdf92fcd87b296 Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Fri, 25 Jul 2025 14:12:05 -0300 Subject: [PATCH 5/6] since component version for the sitemap package --- 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 6387dc823db69..a2ed47abe42ea 100644 --- a/src/content/docs/en/guides/integrations-guide/sitemap.mdx +++ b/src/content/docs/en/guides/integrations-guide/sitemap.mdx @@ -259,7 +259,7 @@ export default defineConfig({ **Type:** `string[]`
**Default:** `[]`
- +

An array of externally sitemaps to be included in the `sitemap-index.xml` file along with the generated sitemap entries. From 72f8718e86c40d8c286aca9c01d7ac945500cea2 Mon Sep 17 00:00:00 2001 From: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:36:14 -0300 Subject: [PATCH 6/6] typo fix --- 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 a2ed47abe42ea..930c1c8251933 100644 --- a/src/content/docs/en/guides/integrations-guide/sitemap.mdx +++ b/src/content/docs/en/guides/integrations-guide/sitemap.mdx @@ -262,7 +262,7 @@ export default defineConfig({

-An array of externally sitemaps to be included in the `sitemap-index.xml` file along with the generated sitemap entries. +An array of externally-generated sitemaps to be included in the `sitemap-index.xml` file along with the generated sitemap entries. Use this option to include external sitemaps in the `sitemap-index.xml` file created by Astro for sections of your deployed site that have their own sitemaps not created by Astro. This is helpful when you host multiple services under the same domain.