Skip to content

Language variant pages not included in the sitemap #14455

@dmgawel

Description

@dmgawel

Astro Info

Astro                    v5.14.1
Node                     v22.18.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/node
Integrations             @astrojs/react
                         @astrojs/sitemap

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

With i18n fallback rewrites configured, language variants of pages are not present in the generated sitemap.

Sample config:

export default defineConfig({
  integrations: [
    sitemap(),
  ],
  i18n: {
    locales: ['en', 'pl', 'fr'],
    defaultLocale: 'en',
    fallback: {
      pl: 'en',
      fr: 'en',
    },
    routing: {
      prefixDefaultLocale: false,
      fallbackType: 'rewrite',
    },
  },
}

All language variants of pages are properly generated in the dist directory (for example /fr/about-us/index.html, /pl/blog/index.html), but only the default locale pages are present in the resulting sitemap.

When i18n config is added to sitemap integration, it still doesn't work (I assume it's only meant for grouping URLs that are already part of the generated sitemap).

What's the expected result?

All configured and generated language variants should be present in the final sitemap.

Using i18n in the sitemap integration should further group URLs as alternate hrefs.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-nbe7xvxy?file=astro.config.mjs,dist%2Fsitemap-0.xml&on=stackblitz

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions