How do I list language alternatives in an XML sitemap?

The Citead team, updated

In short. List each language version in its own XML sitemap entry and repeat the same complete set of xhtml:link alternatives, including a self-reference.

Definition: XML sitemap language annotations associate a page URL with its language and regional alternatives through xhtml:link elements. The hreflang attribute identifies the alternative's language or language and region, while href supplies its URL.

Key facts

Which elements belong in each entry?

Google's sitemap rules for localized pages specify the XHTML namespace declaration xmlns:xhtml="http://www.w3.org/1999/xhtml". The <urlset> root declares this alongside the sitemap namespace.

Each <url> contains a <loc> child giving the URL represented by that entry. Its <xhtml:link> children each carry rel="alternate", a hreflang value and an href URL. These links are children of <url>, alongside <loc>.

Every version repeats the complete alternate set. For example, an English page's entry includes the English URL as well as its German alternatives. The German entries include that same English link and their own self-references. Google says the order of the child links has no effect.

What does a complete alternate set look like?

Google's worked sitemap example contains an English page, a German page and a German page for Switzerland. The following reproduces that example with compact formatting. The codes en, de and de-CH identify those audiences.

<?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://www.example.com/english/page.html</loc>
    <xhtml:link rel="alternate" hreflang="de"
      href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="de-CH"
      href="https://www.example.de/schweiz-deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="en"
      href="https://www.example.com/english/page.html"/>
  </url>
  <url>
    <loc>https://www.example.de/deutsch/page.html</loc>
    <xhtml:link rel="alternate" hreflang="de"
      href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="de-CH"
      href="https://www.example.de/schweiz-deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="en"
      href="https://www.example.com/english/page.html"/>
  </url>
  <url>
    <loc>https://www.example.de/schweiz-deutsch/page.html</loc>
    <xhtml:link rel="alternate" hreflang="de"
      href="https://www.example.de/deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="de-CH"
      href="https://www.example.de/schweiz-deutsch/page.html"/>
    <xhtml:link rel="alternate" hreflang="en"
      href="https://www.example.com/english/page.html"/>
  </url>
</urlset>

What should be checked before submission?

Compare each entry's language and URL pairs with the other entries for that page. Google's general hreflang guidelines require self-references and reciprocal links: when two versions fail to point to each other, Google ignores those tags. The sitemap rules also state that alternate child elements do not count toward the sitemap URL limit.

Google's general sitemap guidelines limit a single sitemap to 50,000 URLs or 50 MB uncompressed. A file exceeding either limit must be split into multiple sitemaps.

The Sitemaps protocol's entity escaping rules require XML values to escape an ampersand as &amp;. This applies when a listed URL contains query parameters separated by an ampersand.

FAQ

Can alternatives use different domains?

Yes. Google's localized page documentation permits alternate URLs on different domains. Its sitemap example uses both www.example.com and www.example.de.

Must I add HTML annotations as well?

You can use the sitemap method on its own. The same documentation treats HTML tags, HTTP headers and sitemaps as equivalent methods and states that using all of them together provides no additional Search benefit.

Sources

  1. Google Search Central, "Tell Google about localized versions of your page", 21 September 2026
  2. Google Search Central, "Build and submit a sitemap", 8 July 2026
  3. Sitemaps.org, "Sitemaps XML format", 21 November 2016

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark