# Create a sitemap index

- Check 24.12 · Multilingual indexing and sitemaps · Critical
- Source: https://checklist-seo-geo.com/en/multilingual-indexing-sitemaps/create-sitemap-index
- Bring each language’s sitemaps together in an index suited to your structure (folders, subdomains or domains), declare it and generate it from your CMS.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/multilingual-indexing-sitemaps/create-sitemap-index.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

A sitemap index is an XML file that lists other sitemaps instead of listing pages. On a multilingual site, it brings together each language’s files (`sitemap-fr.xml`, `sitemap-de.xml`…) and, if needed, their segments by page type, behind a single address to declare and submit. The task is to choose the organization that matches your URL structure, produce the index with a reliable date for each file, then declare it for each host. Once done, each language domain or subdomain exposes a valid index whose child files all return `200`.

## Why it matters

Without an index, each language file has to be declared and submitted separately, and adding the slightest language or segment means touching robots.txt and the webmaster consoles again. With an index, a single entry point is enough: Google and Bing discover the child files, and Search Console shows them under the index with their status and number of URLs. You keep the per-language view gained by [creating per-language sitemaps](https://checklist-seo-geo.com/en/multilingual-indexing-sitemaps/create-per-language-sitemaps-if-useful).

The index also plays a scheduling role: the `<lastmod>` date of each child file tells Google when that file changed, which helps it decide which ones to read again. When you publish a German translation, only the German file should appear modified.

The constraints documented by Google matter particularly on a multilingual site:

- **Same site**: the files listed in an index must be hosted on the same site as the index, unless you use cross-submission.
- **Same folder or lower**: an index placed at the root can list `/sitemaps/sitemap-de.xml`; an index placed in `/de/` cannot list a file at the root.
- **No index inside an index**: an index lists only sitemaps.
- **Volumes**: 50,000 entries per index, and up to 500 indexes submitted per site in Search Console.

Languages spread over `de.example.com` or `example.de` are therefore different sites: an index on `example.com` cannot list their files, unless you set up cross-submission.

## What it improves

- **Management**: a single address per host to declare and submit, whatever the number of languages and segments.
- **Diagnosis**: each language file stays visible under the index, with its status and discovered URLs.
- **Crawling**: reliable dates per file help Google read the languages that change first. The effect is noticeable mostly on large sites.
- **Reliability**: a child file in error is spotted immediately in the list.
- **Rankings**: no direct effect.

## How to check

Read the declared index, then check each child file: HTTP code, number of URLs and dominant language.

```bash
index=$(curl -s https://example.com/robots.txt | grep -i '^sitemap:' | head -n 1 | awk '{print $2}' | tr -d '\r')
curl -s "$index" | head -c 300; echo

for s in $(curl -s "$index" | grep -o '<loc>[^<]*' | sed 's/<loc>//'); do
  code=$(curl -s -o /dev/null -w '%{http_code}' "$s")
  urls=$(curl -s --compressed "$s" | grep -o '<loc>[^<]*' | sed 's/<loc>//')
  count=$(printf '%s\n' "$urls" | grep -c .)
  lang=$(printf '%s\n' "$urls" | sed -E 's#^https?://[^/]+/([a-z]{2})/.*#\1#; s#^https?://.*#default#' | sort | uniq -c | sort -rn | head -n 1 | awk '{print $2}')
  printf '%s\t%s\t%s\t%s\n' "$code" "$count" "$lang" "$s"
done
```

Expected result:

- the first line displayed starts with a `<sitemapindex>` root;
- each child file returns `200`, counts at least one URL and a single dominant language, consistent with its name;
- all child files are on the same host as the index, in the same folder or lower;
- for languages on other hosts, each one declares its own index in its robots.txt.

For a file compressed as `.gz`, replace `curl -s --compressed "$s"` with `curl -s "$s" | gunzip`. In the [Sitemaps report](https://search.google.com/search-console/sitemaps), click the index: the list of child files should match the script’s.

## How to implement

### Before you start

Choose the organization based on your URL structure (see [choose subdirectories, subdomains or country-code domains](https://checklist-seo-geo.com/en/international-architecture/choose-subdirectories-subdomains-country-code-domains)):

| Structure | Index | Declaration |
|---|---|---|
| Subfolders (`example.com/de/`) | One index at the root listing the files of all languages | `robots.txt` of `example.com` |
| Subdomains (`de.example.com`) | One index per subdomain, at its root | `robots.txt` of each subdomain |
| Country-code domains (`example.de`) | One index per domain, at its root | `robots.txt` of each domain |
| Multiple hosts managed by a central team | Possible: a central index with cross-submission | See below |

Example of an index for languages in subfolders, with one segment per language and per type:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemaps/sitemap-fr-pages.xml</loc>
    <lastmod>2026-11-24T10:12:00+01:00</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemaps/sitemap-fr-articles.xml</loc>
    <lastmod>2026-11-22T16:40:00+01:00</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemaps/sitemap-de-pages.xml</loc>
    <lastmod>2026-11-18T09:05:00+01:00</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemaps/sitemap-de-articles.xml</loc>
    <lastmod>2026-11-12T14:20:00+01:00</lastmod>
  </sitemap>
</sitemapindex>
```

Rules:

- **Index at the root**, child files at the root or in a subfolder (`/sitemaps/`).
- **Each file’s `<lastmod>` = the date of the most recent change among its URLs**, not the generation time. See [provide a reliable lastmod](https://checklist-seo-geo.com/en/crawling/provide-reliable-lastmod).
- **Absolute URLs**, files encoded in UTF-8.
- **A file name that states the language**, so you can read the Sitemaps report without opening the files.

Splitting by page type and size limits are detailed in [split large sitemaps](https://checklist-seo-geo.com/en/crawling/split-large-sitemaps).

### Cross-submission between hosts

If a central team wants to host the sitemaps of several domains in the same place, Google documents two methods:

1. **Through Search Console**: verify ownership of all the sites concerned; a sitemap or an index hosted on one of them can then list URLs from the others, and you submit it in Search Console.
2. **Through robots.txt**: host one sitemap per site in a common location (`https://sitemaps.example.com/`), each file containing only the URLs of its own site, then declare it in that site’s robots.txt:

```txt
# https://example.de/robots.txt
Sitemap: https://sitemaps.example.com/sitemap-example-de.xml
```

Bing has historically accepted the same robots.txt principle, with URLs on the same domain as the robots.txt; its current documentation does not go into detail. One index per host, declared in that host’s robots.txt, remains the simplest and safest solution for every search engine.

### Apache

Versions: Apache 2.4.

If the index and the files are generated as static files, make sure they are served with the right type and without long-lived caching:

```apache
<FilesMatch "^sitemap.*\.xml$">
    ForceType application/xml
    Header set Cache-Control "no-cache"
</FilesMatch>
```

`Header` requires the `mod_headers` module. For `.xml.gz` files, check with `curl -sI` that they are not served with a `Content-Encoding: gzip` header, which would cause the file to be decompressed in transit. The block goes in the virtual host or in the `.htaccess` at the root. If an old address (`/sitemap.xml`) is known to search engines and the index has a different name, redirect it: `Redirect 301 /sitemap.xml https://example.com/sitemap_index.xml`.

### Nginx

Versions: Nginx 1.24 and later.

In the `server` block:

```nginx
location ~ ^/(sitemaps/)?sitemap[^/]*\.xml$ {
    types { }
    default_type application/xml;
    add_header Cache-Control "no-cache";
    try_files $uri =404;
}
```

The empty `types` block makes Nginx apply `application/xml` instead of the `text/xml` from the default table, which is also commonly used. If the index is produced by the application, replace `try_files $uri =404;` with the directive that passes the request to the application. Reload with `sudo nginx -t && sudo systemctl reload nginx`.

### Cloudflare

Versions: Cloudflare dashboard, all plans, November 2026.

Cloudflare does not cache `.xml` files by default, but it does cache `.gz` files, and therefore compressed sitemaps. A cache rule that caches everything can also force caching for XML and serve an outdated index. In these cases, exclude the `/sitemap` paths in [Cache Rules](https://dash.cloudflare.com/?to=/:account/:zone/caching/cache-rules), or purge these URLs after each generation. Also check that no security rule presents a challenge to search engine bots on these files.

### WordPress

Versions: WordPress 6.8 to 7.1; Yoast SEO, Rank Math, WPML 4.x and Polylang 3.x in their November 2026 versions.

- **Yoast SEO and Rank Math** produce an index at `/sitemap_index.xml`. With WPML or Polylang in subfolders, it covers all languages; with one subdomain or domain per language, each host has its own index.
- **WordPress’s native sitemap**: an index at `/wp-sitemap.xml`, with no language handling.

To add language sitemaps generated elsewhere (for example by a scheduled command) to the Yoast index, use the `wpseo_sitemap_index` filter in the child theme’s `functions.php`:

```php
add_filter('wpseo_sitemap_index', function (string $items): string {
    foreach (['de', 'en'] as $locale) {
        $file = ABSPATH . "sitemaps/sitemap-{$locale}.xml";

        if (! file_exists($file)) {
            continue;
        }

        $url = home_url("/sitemaps/sitemap-{$locale}.xml");
        $lastmod = gmdate('c', filemtime($file));

        $items .= "<sitemap><loc>{$url}</loc><lastmod>{$lastmod}</lastmod></sitemap>";
    }

    return $items;
});
```

The file date is only suitable here if the command rewrites the file solely when its content changes. Then clear the Yoast sitemap cache by turning the feature off and on again.

### Shopify

Versions: Shopify admin, all plans (international domains from the Basic plan), November 2026.

The `sitemap.xml` at the root of each domain is already an index, kept up to date by Shopify, and published languages are added to it automatically. With international domains, each domain has its own index: submit them one by one. Nothing to build.

### Laravel

Versions: Laravel 10 to 13; spatie/laravel-sitemap 7 (Laravel 10 to 12) or 8 (Laravel 12 and 13).

With spatie/laravel-sitemap, after writing one file per language (see [create per-language sitemaps](https://checklist-seo-geo.com/en/multilingual-indexing-sitemaps/create-per-language-sitemaps-if-useful)), build the index in the same Artisan command:

```php
use App\Models\PageTranslation;
use Illuminate\Support\Carbon;
use Spatie\Sitemap\SitemapIndex;
use Spatie\Sitemap\Tags\Sitemap as SitemapTag;

$index = SitemapIndex::create();

foreach (config('app.supported_locales') as $locale) {
    $lastModified = PageTranslation::query()
        ->where('locale', $locale)
        ->where('status', 'published')
        ->where('indexable', true)
        ->max('content_updated_at');

    if (! $lastModified) {
        $this->warn("No indexable page for {$locale}, skipped.");

        continue;
    }

    $this->info("Adding sitemap-{$locale}.xml to the index...");

    $index->add(
        SitemapTag::create("/sitemap-{$locale}.xml")
            ->setLastModificationDate(Carbon::parse($lastModified))
    );
}

$index->writeToFile(public_path('sitemap_index.xml'));

$this->comment('Sitemap index written.');
```

With one domain per language, write one index per domain and serve it from a route that reads the request’s host.

### Next.js

Versions: Next.js 15 and 16 (App Router).

Next.js does not generate an index. Add a route handler that lists the files produced by `generateSitemaps()`:

```ts
// app/sitemap_index.xml/route.ts
import { getLastModifiedByLocale } from '@/lib/pages'

const BASE_URL = 'https://example.com'
const locales = ['fr', 'de', 'en']

export async function GET() {
  const entries = await Promise.all(
    locales.map(async (locale) => {
      const lastModified = await getLastModifiedByLocale(locale)

      return `<sitemap><loc>${BASE_URL}/sitemap/${locale}.xml</loc><lastmod>${lastModified.toISOString()}</lastmod></sitemap>`
    }),
  )

  const body = `<?xml version="1.0" encoding="UTF-8"?><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${entries.join('')}</sitemapindex>`

  return new Response(body, {
    headers: { 'Content-Type': 'application/xml' },
  })
}
```

Use the same list of languages as `generateSitemaps()`, ideally imported from a shared module, so that the index stays accurate when a language is added.

### Astro

Versions: Astro 5 to 7, @astrojs/sitemap 3.7 and later.

The `@astrojs/sitemap` integration always writes a `sitemap-index.xml` that lists the generated files, including the per-language segments created with the `chunks` option. All you need to do is declare and submit it.

### After setup

1. Declare the index in the robots.txt of each host: `Sitemap: https://example.com/sitemap_index.xml` (see [declare sitemaps in robots.txt](https://checklist-seo-geo.com/en/crawling/declare-sitemaps-robotstxt)).
2. Submit it in Search Console and Bing Webmaster Tools (see [submit sitemaps to Google/Bing](https://checklist-seo-geo.com/en/multilingual-indexing-sitemaps/submit-sitemaps-google-bing)).
3. Remove from the consoles and from robots.txt the old files submitted one by one that are now in the index, to avoid duplicate tracking. Keep a language file submitted separately only if you want to follow it closely.

## Common mistakes

- **Listing the sitemaps of `de.example.com` in the index of `example.com`** without cross-submission: Google does not take them into account.
- **Placing the index in a language subfolder** (`/de/sitemap_index.xml`) and listing root files in it: they are out of its scope.
- **Nesting indexes**: a per-language index that is itself listed in a general index is not accepted.
- **Dating every file with the generation time**: each language appears modified on every run, and the information is lost.
- **Missing a child file that returns `404`**: the index looks valid, but a whole language disappears from the sitemaps.
- **Letting a CDN serve an outdated index** after a language is added.

## Frequently asked questions

### Can a sitemap index contain sitemaps from several domains?

A sitemap index can only list files hosted on the same site as the index, unless you use cross-submission. Google accepts it if you have verified all the domains concerned in Search Console, or if each domain’s robots.txt declares its own sitemap hosted elsewhere. For languages on separate domains or subdomains, one index per host, declared in its robots.txt, remains the simplest option.

### Should you have one index per language or a common index?

With languages in subfolders of the same domain, a common index at the root, listing each language’s files, is enough and keeps the per-language view in Search Console. With subdomains or country-code domains, each host has its own index. Do not create one index per language grouped in a general index: nested indexes are not accepted.

### Which date should go in the lastmod of a sitemap index?

The lastmod date of a file listed in a sitemap index should be the date of the most recent change among the URLs it contains, for example the last German translation published or updated for the German file. Do not use the generation time: every file would appear modified on each run, and Google could no longer spot the languages that really change.

### Should you submit the index or each language sitemap?

Submitting the index is enough: Google and Bing discover the language sitemaps it lists, and Search Console shows them under the index with their status and discovered URLs. You can also submit a specific language file so you can filter on it easily in the indexing report. Also declare the index in robots.txt, for search engines whose console you do not use.

## Resources

- [Google Search Central: Manage large sitemaps with a sitemap index](https://developers.google.com/search/docs/crawling-indexing/sitemaps/large-sitemaps)
- [Google Search Central: Build a sitemap and manage multiple sites](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap)
- [sitemaps.org protocol: sitemap index files](https://www.sitemaps.org/protocol.html)
- [Search Console Help: Sitemaps report](https://support.google.com/webmasters/answer/7451001?hl=en)
- [Bing: Keeping content discoverable with sitemaps in AI-powered search](https://blogs.bing.com/webmaster/July-2025/Keeping-Content-Discoverable-with-Sitemaps-in-AI-Powered-Search)
- [Yoast: How to customize the sitemap index](https://yoast.com/help/how-to-customize-the-sitemap-index/)
- [Next.js: generateSitemaps](https://nextjs.org/docs/app/api-reference/functions/generate-sitemaps)
- [spatie/laravel-sitemap](https://github.com/spatie/laravel-sitemap)

Next steps: [automate sitemaps](https://checklist-seo-geo.com/en/multilingual-indexing-sitemaps/automate-sitemaps) and [submit sitemaps to Google/Bing](https://checklist-seo-geo.com/en/multilingual-indexing-sitemaps/submit-sitemaps-google-bing).
