Multilingual sitemap

How to build a multilingual sitemap that search engines can use

Learn how to include localized static and dynamic URLs, language alternates, last-modified dates, and supplemental translation sitemaps in a multilingual site.

/ The short answer

A multilingual sitemap should describe the URLs your site actually serves. For dynamic products, articles, and documentation, generate one entry per language version and keep alternate-language relationships consistent with the page head.

/ 01

Source of truth

Start with the site-owned sitemap

Your application sitemap should contain every canonical public URL, including dynamic pages. Treat it as the source of truth for what is live, indexable, and worth discovering.

  • Use the same public origin as the pages.
  • Include updated timestamps from the source record when possible.
  • Do not include preview, authenticated, or redirected URLs.
Site-owned sitemap
export default function sitemap() {
  return publicPages.map((page) => ({
    url: `https://example.com${page.path}`,
    lastModified: page.updatedAt,
  }));
}
/ 02

Language versions

Add localized URLs and alternates

Next.js can emit language alternate links from sitemap entries. For each source page, map the complete set of published language URLs and keep the map stable across every version.

  • Use the same content identity across languages.
  • Exclude a locale until its page is actually published.
  • Keep the canonical URL and sitemap URL consistent.
Localized sitemap entries
export default async function sitemap() {
  const products = await getPublicProducts();
  const locales = ["en", "fr", "de"];

  return products.flatMap((product) => locales.map((locale) => ({
    url: `https://example.com/${locale}/products/${product.slug}`,
    lastModified: product.updatedAt,
    alternates: {
      languages: Object.fromEntries(locales.map((language) => [
        language, `https://example.com/${language}/products/${product.slug}`
      ])),
    },
  })));
}
/ 03

Large sites

Split sitemaps without splitting ownership

Large sites can use sitemap indexes and shards by locale, content type, or record range. The index should point to reachable child sitemaps, and each child should remain below the search engine limits.

  • Use deterministic shard names.
  • Keep one clear index route.
  • Monitor child sitemap response codes and XML validity.
/ 04

Altified workflow

Use the supplemental sitemap for translated discovery

Altified can generate a supplemental sitemap containing additional-language URLs from your existing site sitemap. It does not replace the site-owned sitemap and it does not add hreflang to pages by itself; your application still needs reciprocal metadata.

  • Keep /sitemap.xml complete and site-owned.
  • Publish /altified-sitemap.xml after target locales and routes exist.
  • Submit both sitemaps or list both in robots rules.

/ Production checklist

Verify the language experience before launch.

  • The canonical site sitemap returns 200.
  • Every dynamic page is represented.
  • Language URLs are real and indexable.
  • Alternate-language mappings are reciprocal.
  • Sitemap index children are reachable.
  • The Altified supplemental sitemap is submitted separately when used.

/ Frequently asked questions

Questions teams ask before implementing multilingual SEO.

What is a multilingual XML sitemap?

It is a sitemap that helps search engines discover localized URLs, optionally including xhtml language alternate relationships for each content URL.

Does a sitemap replace hreflang tags?

No. A sitemap can provide language relationships, but the page HTML should still expose consistent reciprocal hreflang metadata when that is part of the site’s implementation.

Should the translated sitemap replace the main sitemap?

No. Keep the site-owned sitemap as the source of truth and use a supplemental translated sitemap only to add language URLs that are not already present.