#sitemap

10 messages · Page 1 of 1 (latest)

quiet canyonBOT
#

Hi @sour gulch. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Astro provides an integration called @astrojs/sitemap that generates a sitemap based on your pages when you build your Astro project. This sitemap is an XML file that outlines all of the pages, videos, and files on your site, which search engines like Google use to crawl your site more efficiently. This is particularly recommended for large multi-page sites to ensure that your site is as search engine friendly as possible.

The Astro Sitemap integration will crawl your statically-generated routes and create the sitemap file, including dynamic routes like [...slug] or src/pages/[lang]/[version]/info.astro generated by getStaticPaths(). However, it cannot generate sitemap entries for dynamic routes in SSR mode.

Here is an example of a minimal Astro configuration that uses the sitemap integration:

export default defineConfig({
  site: "<https://example.com",>
  base: "/blog",
  output: "static",
  adapter: vercel(),
  integrations: [
    sitemap(),
  ],
  trailingSlash: "never",
});

This configuration will produce two sitemap files: sitemap-index.xml and sitemap-0.xml.

For more information, you can refer to the Astro Sitemap documentation (https://docs.astro.build/en/guides/integrations-guide/sitemap#_top) and the Astro Sitemap GitHub page (https://github.com/withastro/astro/tree/main/packages/integrations/sitemap/).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@sour gulch kapa.ai is still learning and improving, please let us know how it did by reacting below

sour gulch
#

@quiet canyon Why two sitemap

quiet canyonBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Astro generates two sitemap files when the number of entries exceeds the limit set by the entryLimit configuration option. The default value for entryLimit is 45000. If you have more entries than this limit, Astro will create a sitemap index and multiple sitemaps.

The sitemap-index.xml file is the sitemap index. It lists the locations of all the other sitemap files. The sitemap-0.xml file is the first sitemap file listed in the sitemap index. If you have more entries, additional sitemap files like sitemap-1.xml, sitemap-2.xml, etc., will be created.

Here's an example of how to set the entryLimit configuration option:

import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';

export default defineConfig({
  site: '<https://stargazers.club',>
  integrations: [
    sitemap({
      entryLimit: 10000,
    }),
  ],
});

In this example, the entryLimit is set to 10000, so a new sitemap file will be created for every 10000 entries.

For more information, you can refer to the Astro Sitemap documentation (https://docs.astro.build/en/guides/integrations-guide/sitemap#entrylimit).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@sour gulch kapa.ai is still learning and improving, please let us know how it did by reacting below

sour gulch
#

@quiet canyon can i customize name of the file sitemap-index

quiet canyonBOT
#

Let me check the knowledge base for you. One moment! :books:

#

I'm sorry, but based on the provided extracts, there's no information available about customizing the name of the sitemap-index.xml file when using the Astro Sitemap integration. The default filenames sitemap-index.xml and sitemap-0.xml are standard naming conventions used for sitemaps and are recognized by search engines.

For more detailed information or potential customization options, you may want to refer to the Astro Sitemap documentation (https://docs.astro.build/en/guides/integrations-guide/sitemap#_top) or the Astro Sitemap GitHub page (https://github.com/withastro/astro/tree/main/packages/integrations/sitemap/).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: