In short
On a multilingual site, the sitemap has to follow every translation: a published German page goes in, a withdrawn translation comes out, and the hreflang annotations that link the versions stay accurate. By hand, this becomes unmanageable beyond a few dozen pages. The task is to hand over the production of every language’s sitemaps to the CMS, the translation plugin or the application, based on the translations that are actually published. Expected result: files that update themselves, with one entry per translation and, if you declare hreflang in the sitemap, the full list of versions in every entry.
Why it matters
A multilingual sitemap carries two pieces of information: the list of URLs to crawl in each language and, if it contains hreflang annotations, the correspondence between versions. Google describes this second use precisely: each language version has its own <url> entry, and each entry lists every version, itself included, with <xhtml:link rel="alternate"> elements. Three versions of a page give three entries, each carrying the same three links.
This structure degrades quickly when it is not generated. An added translation must appear in the entries of all its siblings; a deleted translation must disappear everywhere. Missing one side breaks reciprocity, and Google ignores annotations that do not confirm each other. On a 500-page site in four languages, that means 2,000 entries and 8,000 links to keep up to date.
A frozen sitemap also has an indexing cost: new translations, which often have few external links at first, are discovered later. For generative engines, the effect is indirect: Copilot and AI Overviews rely on the Bing and Google indexes, which an accurate sitemap helps keep up to date language by language. A translation discovered earlier is not necessarily cited, though.
What it improves
- Discovery of each language A published translation is signaled without waiting for a link to lead to it.
- Hreflang reliability Reciprocal, complete annotations, recalculated at each publication.
- Diagnosis Accurate sitemaps let you measure each language’s indexing rate in Search Console.
- Maintenance No more files to fix after each translation.
- Rankings No direct effect. The effect goes through indexing and the display of the right language version.
How to check
1. Does the number of URLs per language follow publications? For a site using subdirectories:
curl -s --compressed https://example.com/sitemap.xml | grep -o "<loc>[^<]*" | sed -E 's#<loc>https://[^/]+/([a-z]{2}(-[a-z]{2})?)/.*#\1#' | sort | uniq -c
With an index, run the command on each child file. Compare each total with the number of published, indexable translations in the CMS, then publish a test translation: its total should increase after the expected generation delay.
2. Are the annotations complete? If the sitemap contains xhtml:link elements, each entry for a page translated into four languages should carry four of them (five with x-default). This short Python script counts the entries whose list of links does not include their own URL, or where a link points to a URL missing from the file:
# python3 -I verifier_sitemap.py https://example.com/sitemap-fr.xml https://example.com/sitemap-de.xml
import sys, urllib.request, xml.etree.ElementTree as ET
NS = {"s": "http://www.sitemaps.org/schemas/sitemap/0.9", "x": "http://www.w3.org/1999/xhtml"}
entries = {}
for source in sys.argv[1:]:
root = ET.parse(urllib.request.urlopen(source)).getroot()
for url in root.findall("s:url", NS):
loc = url.findtext("s:loc", namespaces=NS).strip()
entries[loc] = {link.get("href") for link in url.findall("x:link", NS)}
for loc, alternates in entries.items():
if alternates and loc not in alternates:
print(f"No self-reference: {loc}")
for href in alternates - set(entries):
print(f"Alternate missing from the sitemaps: {href} (from {loc})")
print(f"{len(entries)} entries checked.")
Expected result: no line before the total. A missing alternate points either to a translation that is not listed, or to a link to a page that should not be listed (see exclude unpublished or non-indexable translations (opens in a new tab)).
3. What do search engines see? The Search Console Sitemaps report and the Sitemaps page in Bing Webmaster Tools should show a recent read and a number of discovered URLs close to your totals.
How to implement
Before you start
Choose how the files are organized. Two patterns work:
| Organization | When to choose it | What the generator must produce |
|---|---|---|
| One sitemap per language, grouped in an index | General case, and as soon as you want to track indexing language by language | sitemap-fr.xml, sitemap-de.xml… and an index that lists them |
| A single sitemap with all languages | Small site, tool that cannot split | One file, one entry per translation |
| One sitemap per domain or subdomain | Languages on example.de, de.example.com |
One file or index at the root of each host |
See create per-language sitemaps if useful (opens in a new tab) and create a sitemap index (opens in a new tab).
Choose where to declare hreflang. In the <head>, in the sitemap or in HTTP headers: Google accepts all three. A single method is enough; if you combine two, they must say exactly the same thing (see check consistency across HTML, HTTP header and sitemap methods (opens in a new tab)). The sitemap is the most convenient method for a generator, since it sees all the translations at once.
Expected format, here for a page in French, German and English, with x-default:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://example.com/fr/tarifs/</loc>
<lastmod>2026-11-18T10:00:00+01:00</lastmod>
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs/"/>
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise/"/>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/pricing/"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/pricing/"/>
</url>
<url>
<loc>https://example.com/de/preise/</loc>
<lastmod>2026-11-20T15:30:00+01:00</lastmod>
<xhtml:link rel="alternate" hreflang="fr" href="https://example.com/fr/tarifs/"/>
<xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/preise/"/>
<xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/pricing/"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/en/pricing/"/>
</url>
<!-- same block for https://example.com/en/pricing/ -->
</urlset>
xhtml:link links do not count towards the 50,000-URL limit per file, but they make the file heavier: also keep an eye on the 50 MB uncompressed limit.
Rules for the generator:
- Source: the table of published translations, not a crawl. A crawl includes untranslated fallback pages and misses orphaned translations.
- Translation group: the generator needs to know which URLs are equivalents. Without a group identifier in the database (ID of the original, translation key), it cannot produce
hreflang. - Filter: only translations that are published, indexable, return 200 and have a canonical pointing to themselves. See use a self-referencing canonical for each actual translation (opens in a new tab).
lastmod: the modification date of each translation, not that of the original. See manage lastmod per translation (opens in a new tab).- Trigger: each time a translation is published, unpublished or deleted, or through a scheduled task at least daily.
- A single generator: the SEO plugin, the translation plugin and the native sitemap must not each produce their own files.
The general principle of an automatic sitemap is detailed in generate the XML sitemap automatically (opens in a new tab); the following sections cover what changes with several languages.
WordPress
Versions WordPress 6.8 to 7.1; WPML 4.x, Polylang 3.x, TranslatePress, Weglot, Yoast SEO and Rank Math in their November 2026 versions.
The behavior depends on the translation plugin, which hooks into the SEO plugin’s sitemap:
- WPML with Yoast SEO: a single sitemap for all languages when they share the domain, one sitemap per domain when each language has its own. According to WPML’s documentation, its SEO module adds the
hreflangannotations of each translation to the Yoast sitemap and then removes those in the<head>. To keep them in the<head>only, setWPML_SEO_ENABLE_SITEMAP_HREFLANGtofalseinwp-config.php, then re-enable the “Display alternative languages in the HEAD section” option inWPML > Settings > URLs and SEO. The sitemap annotations are only visible in the raw XML, not in the browser’s formatted view. - Polylang: each translation is a separate post, which the WordPress, Yoast SEO or Rank Math sitemaps list in its language. Check in the generated file whether your combination of plugins adds
hreflanglinks to the sitemap or leaves them in the<head>only. - TranslatePress: the SEO Pack add-on, available with paid licenses only, extends the sitemap of Yoast SEO, Rank Math, SEOPress, All in One SEO, Squirrly SEO or Slim SEO with the translated URLs and their alternate links.
- Weglot: depending on the integration, translated URLs may not be added to the sitemap. Open the file; if they are missing, the
hreflangannotations in the<head>are enough for Google to discover them, but you lose tracking through the sitemap.
Check after installation: open the sitemap source (view-source: or curl), count the URLs per language and make sure no second sitemap is active (/wp-sitemap.xml should redirect or not exist if an SEO plugin has taken over).
Shopify
Versions Shopify admin, all plans (international domains from the Basic plan), November 2026.
Automatic. Shopify adds published languages to the sitemaps of each domain, with no setting. With international domains, on the Basic plan or higher, each domain has its own /sitemap.xml, to be submitted separately. The sitemap cannot be edited: what you check is what you publish in Settings > Languages and the translations entered with the Translate & Adapt app.
PrestaShop
Versions PrestaShop 8 and 9, up-to-date Google sitemap module (gsitemap).
The “Google sitemap” module (gsitemap) writes one index per store and one file per active language. Schedule the cron task URL shown in its configuration (see generate the XML sitemap automatically (opens in a new tab)). The module does not declare hreflang: keep the annotations in the <head>, through the theme or a dedicated module. Disable a language in International > Localization > Languages as long as its translations are not ready, otherwise its URLs go into the sitemap.
Magento
Versions Magento Open Source and Adobe Commerce 2.4.7 to 2.4.9.
A sitemap is created per store view (Store View), which usually carries the language: Marketing > SEO & Search > Site Map > Add Sitemap, choose the view, a distinct file name (sitemap-fr.xml, sitemap-de.xml) and a path, then Save & Generate. Scheduled generation is set in Stores > Settings > Configuration > Catalog > XML Sitemap and depends on Magento’s cron. Magento does not add hreflang to the sitemap natively: an extension or the template takes care of it.
Drupal
Versions Drupal 10.3 and 11, Simple XML Sitemap 4.x.
Simple XML Sitemap handles translations. In Configuration > Search and metadata > Simple XML Sitemap > Settings, language section:
- “Skip non-existent translations”: check it so that links are only generated to the languages into which the entity is actually translated;
- “Exclude languages”: exclude a language that is still in preparation;
- “Remove hreflang markup in HTML”: check it only if you want the sitemap to be the only source of annotations.
The sitemaps are regenerated by Drupal’s cron; check that it runs. After changing a setting, run the generation again: drush simple-sitemap:generate.
Wix
Versions Wix Multilingual, Wix Editor and Wix Studio, November 2026.
With Wix Multilingual, sitemaps are generated per language (files prefixed with the language code) and updated at each publication. When you add a secondary language, Wix asks whether it should be visible right away: keep it hidden and make it visible only when its translations are ready. If your languages are on subdomains, each one has its own sitemap to submit.
Webflow
Versions Webflow Localization, plans that include localization, November 2026.
With Webflow Localization, the automatic sitemap (Site settings > SEO) includes the localized routes and their hreflang annotations, according to Webflow’s release notes. Only the languages whose publishing is enabled appear in it. If you replace the automatic sitemap with a custom sitemap, Webflow no longer adds anything: the annotations are then up to you.
Laravel
Versions Laravel 10 to 13; spatie/laravel-sitemap 7 (Laravel 10 to 12) or 8 (Laravel 12 and 13).
With spatie/laravel-sitemap, a scheduled command writes one file per language and an index. Here the translation model exposes a publishedAndIndexable() scope and a url() method; adapt to your schema.
<?php
// app/Console/Commands/GenerateMultilingualSitemapsCommand.php
namespace App\Console\Commands;
use App\Models\Post;
use App\Models\PostTranslation;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Spatie\Sitemap\Sitemap;
use Spatie\Sitemap\SitemapIndex;
use Spatie\Sitemap\Tags\Sitemap as SitemapTag;
use Spatie\Sitemap\Tags\Url;
class GenerateMultilingualSitemapsCommand extends Command
{
protected $signature = 'generate-multilingual-sitemaps';
protected $description = 'Write one sitemap per locale with hreflang alternates, plus an index';
public function handle(): void
{
$index = SitemapIndex::create();
foreach (config('app.supported_locales') as $locale) {
$this->info("Building sitemap for `{$locale}`...");
$sitemap = Sitemap::create();
$latest = null;
Post::query()
->whereHas('translations', fn ($query) => $query->where('locale', $locale)->publishedAndIndexable())
->with(['translations' => fn ($query) => $query->publishedAndIndexable()])
->lazyById()
->each(function (Post $post) use ($sitemap, $locale, &$latest): void {
$current = $post->translations->firstWhere('locale', $locale);
$sitemap->add($this->urlFor($current, $post->translations));
$latest = max($latest, $current->content_updated_at);
});
$path = "sitemaps/sitemap-{$locale}.xml";
$sitemap->writeToFile(public_path($path));
$tag = SitemapTag::create(url($path));
if ($latest !== null) {
$tag->setLastModificationDate($latest);
}
$index->add($tag);
$count = count($sitemap->getTags());
$this->comment("{$count} URLs written for `{$locale}`.");
}
$index->writeToFile(public_path('sitemap.xml'));
}
/** @param Collection<int, PostTranslation> $translations */
private function urlFor(PostTranslation $current, Collection $translations): Url
{
$url = Url::create($current->url())->setLastModificationDate($current->content_updated_at);
$translations->each(fn (PostTranslation $translation) => $url->addAlternate($translation->url(), $translation->locale));
return $url;
}
}
The alternates are loaded with the same filter as the entries: an unpublished translation can neither have an entry nor be referenced in the entries of the other languages. For an immediate update, also run the command from a listener on translation publication. The scheduler assumes that the crontab runs php artisan schedule:run every minute. Only the place where the command is scheduled changes between versions.
Laravel 11 to 13
<?php
// routes/console.php
use Illuminate\Support\Facades\Schedule;
Schedule::command('generate-multilingual-sitemaps')->hourly();
Laravel 10
<?php
// app/Console/Kernel.php (excerpt)
protected function schedule(Schedule $schedule): void
{
$schedule->command('generate-multilingual-sitemaps')->hourly();
}
Symfony
Versions Symfony 6.4 to 8.1, PrestaSitemapBundle 4.
PrestaSitemapBundle provides the GoogleMultilangUrlDecorator decorator, which adds xhtml:link links to a URL:
use Presta\SitemapBundle\Sitemap\Url\GoogleMultilangUrlDecorator;
use Presta\SitemapBundle\Sitemap\Url\UrlConcrete;
$url = new GoogleMultilangUrlDecorator(new UrlConcrete($currentUrl, $translation->getUpdatedAt()));
foreach ($publishedTranslations as $sibling) {
$url->addLink($sibling->getAbsoluteUrl(), $sibling->getLocale());
}
$event->getUrlContainer()->addUrl($url, "pages_{$translation->getLocale()}");
Place this code in the SitemapPopulateEvent subscriber described in the general guide. The second argument of addUrl creates one section per language: bin/console presta:sitemaps:dump then writes one file per section and the index that groups them.
Next.js
Versions Next.js 15 and 16 (App Router).
Since Next.js 14.2, each entry in app/sitemap.ts accepts alternates.languages. Next.js writes exactly what you give it: include the entry’s own language in the list, which the documentation example does not do.
// app/sitemap.ts
import type { MetadataRoute } from 'next'
type Translation = { locale: string; path: string; updatedAt: string }
type Page = { translations: Translation[] }
const BASE_URL = 'https://example.com'
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const response = await fetch('https://cms.example.com/api/pages?status=published&indexable=true', {
next: { revalidate: 3600 },
})
const pages: Page[] = await response.json()
return pages.flatMap((page) => {
const languages = Object.fromEntries(
page.translations.map((translation) => [translation.locale, `${BASE_URL}${translation.path}`]),
)
return page.translations.map((translation) => ({
url: `${BASE_URL}${translation.path}`,
lastModified: translation.updatedAt,
alternates: { languages },
}))
})
}
The CMS API should return, for each page, only the published and indexable translations. For one file per language, use generateSitemaps() with the language codes as identifiers (see create per-language sitemaps if useful (opens in a new tab)).
Nuxt
Versions Nuxt 3.x and 4, @nuxtjs/sitemap 7 to 9 (version 9 requires Nuxt 4.6 or later) with @nuxtjs/i18n 9 and 10.
With @nuxtjs/i18n, the @nuxtjs/sitemap module automatically produces one sitemap per language (/__sitemap__/fr-FR.xml, /__sitemap__/de-DE.xml…) and an index /sitemap_index.xml, except with the no_prefix strategy. Pages in pages/ get their alternates. For dynamic URLs returned by a source, there are two options:
_i18nTransform: trueon a URL generates it in every language;_sitemap: 'de-DE'assigns it to a single language.
Only use _i18nTransform for content that is actually translated everywhere; otherwise, return one entry per existing translation with _sitemap.
Astro
Versions Astro 5 to 7, @astrojs/sitemap 3.
The @astrojs/sitemap integration accepts an i18n option that adds alternate links between versions:
// astro.config.mjs
import { defineConfig } from 'astro/config'
import sitemap from '@astrojs/sitemap'
export default defineConfig({
site: 'https://example.com',
integrations: [
sitemap({
i18n: {
defaultLocale: 'fr',
locales: { fr: 'fr-FR', de: 'de-DE', en: 'en-US' },
},
}),
],
})
Versions are matched by their path, ignoring the language prefix: with translated slugs (/de/preise/ versus /fr/tarifs/), check the result and, if needed, build the links yourself in serialize(). The sitemap is only regenerated at build time: trigger a build through a CMS webhook at each publication.
Common mistakes
- Listing only the main language with links to the others: the translations have no entry, and tracking their own indexing becomes impossible.
- Forgetting the self-reference in the
xhtml:linkelements (the case with the Next.js example as is). - Generating from a crawl: untranslated fallback pages enter the sitemap as if they were translations.
- Two generators: the translation plugin’s sitemap and the SEO plugin’s sitemap, with different language lists.
- A
lastmodshared by all languages, copied from the original. - Different annotations in the
<head>and in the sitemap, because two components calculate them separately. - A language in preparation already active on PrestaShop, Wix or Shopify: its URLs go into the sitemap before they are translated.
- A sitemap cached by the CDN for days: new translations do not show up in it.
Frequently asked questions
Do you need a separate sitemap for each language?
It is not mandatory, but it is the most practical option. A single sitemap works as long as it stays under 50,000 URLs and 50 MB. One file per language, grouped in an index, also lets you filter the Search Console indexing report by language and spot the one that is falling behind. If your languages are on separate domains or subdomains, each host has its own sitemap anyway.
Should hreflang go in the sitemap or in the HTML code?
Google accepts hreflang in the head, in HTTP headers or in the sitemap, and a single method is enough. The sitemap suits automatic generation well, because the generator sees all the translations at once, and it lightens the HTML. If you combine two methods, they must be strictly identical. Above all, avoid having two components that each calculate their own annotations.
Does my translation plugin generate the sitemap on its own?
Often, but not always completely. WPML, and TranslatePress with its SEO Pack add-on, enrich the SEO plugin’s sitemap; Shopify, Wix and Webflow add published languages automatically. With other tools, translated URLs may be missing. Open the sitemap as raw XML, count the URLs of each language and compare with the number of published translations.
How often should a multilingual sitemap be regenerated?
At each publication, change or withdrawal of a translation, or at least once a day through a scheduled task. Platforms that generate the sitemap on demand, such as Shopify or WordPress with an SEO plugin, do not need a task. On Magento, Drupal, Laravel or Astro, check that the cron or the build actually runs, otherwise new translations do not appear.
Resources
- Google: Tell Google about localized versions of your pagedevelopers.google.com
- Google: Build and submit a sitemapdevelopers.google.com
- WPML: Using Yoast SEO with WPMLwpml.org
- TranslatePress: SEO Pack add-ontranslatepress.com
- Shopify: Finding your store’s sitemaphelp.shopify.com
- Drupal: Simple XML Sitemapdrupal.org
- Next.js: localized sitemap, Nuxt: sitemap and i18n and Astro: i18n option of @astrojs/sitemapnextjs.org
- spatie/laravel-sitemap and PrestaSitemapBundlegithub.com
Updated on
Topic checklist (PDF)