A hreflang sitemap is an XML sitemap that declares language and regional alternates for each URL by adding xhtml:link elements with rel="alternate" and a hreflang value. In international SEO it is one of the three supported ways to implement hreflang, alongside HTML link elements in the page head and HTTP headers.
Moving annotations into the sitemap keeps page templates clean and makes large multilingual and multiregional websites easier to manage, because all relationships live in files that can be generated, validated and versioned centrally.
How hreflang annotations work inside a sitemap
Each url entry in a hreflang sitemap lists every language or regional version of the same content, including a reference to itself. The sitemap must declare the xhtml namespace, and each alternate is written as xhtml:link with the attributes rel, hreflang and href.
The annotations form a hreflang cluster: a set of equivalent pages that all point to one another. Because every page in the cluster appears as its own url entry with the full list of alternates, the return tag requirement is satisfied automatically when the file is generated correctly.
The table below summarizes the elements and attributes that a valid entry contains.
| Element or attribute | Role | Example value |
|---|---|---|
loc | Canonical URL of the page described by the entry | Path such as /de-at/preise/ |
xhtml:link | Declares one alternate version | One element per language or region |
rel | Defines the relationship type | alternate |
hreflang | Language code, optionally with region code | de-AT, en, x-default |
href | Absolute URL of the alternate page | Full address of /en-gb/pricing/ |
| Namespace declaration | Enables the xhtml prefix in the file | The W3C XHTML namespace URI |
Language and region codes in a hreflang sitemap
Hreflang values use ISO 639-1 language codes, optionally followed by an ISO 3166-1 Alpha 2 region code, as in en-US or pt-BR. A region code alone is invalid, so us or uk without a language will be ignored, and en-UK is a common error because the correct region code for the United Kingdom is GB.
The special value x-default marks the fallback page for users whose language or location matches no listed version. It typically points to a language selector or a global English page and should appear in every entry of the cluster.
| Value | Valid | Meaning or problem |
|---|---|---|
en | Yes | English for all regions |
en-GB | Yes | English for the United Kingdom |
es-419 | No for Google | UN M.49 region codes are not supported |
en-UK | No | UK is not an ISO 3166-1 code |
zh-Hant-TW | Yes | Traditional Chinese script for Taiwan |
x-default | Yes | Fallback for unmatched users |
Sitemap method compared with other hreflang implementations
The sitemap method is functionally equivalent to HTML and HTTP header annotations for Google, so the choice depends on scale, technical control and maintenance effort. Mixing methods is allowed but increases the risk of conflicting signals, so most teams pick one method per site.
| Method | Best suited for | Main drawback |
|---|---|---|
| XML sitemap | Large sites with many language versions | Changes become visible only after recrawl of the sitemap |
| HTML link elements | Small and medium sites with editable templates | Adds many lines to every page head |
| HTTP headers | PDFs and other non-HTML files | Hard to audit without server access |
On a site with 20 language versions, HTML annotations add 21 link lines to every page, which inflates page weight and complicates template releases. In a sitemap, the same data sits in a separate, machine-generated file that developers and SEO specialists can audit without touching page code.
Bing and several regional engines treat hreflang differently. Bing has historically relied more on the Content-Language meta tag or header, while Yandex supports hreflang in sitemaps, so a multi-engine strategy should not assume that one method covers every search engine.
Building and maintaining a hreflang sitemap at scale
Reliable hreflang sitemaps are generated from a single source of truth, typically a database table that maps each content item to its localized URLs. Manual editing breaks down quickly because one missing alternate invalidates part of the cluster.
- List only canonical, indexable URLs that return status 200; redirected or noindexed pages create errors.
- Respect the sitemap limits of 50,000 URLs and 50 MB uncompressed per file, and use a sitemap index for larger sets.
- Remember that each alternate counts toward file size, so files with many languages reach the size limit before the URL limit.
- Submit the files in Google Search Console and reference them in robots.txt so crawlers discover them.
- Regenerate on publish and unpublish so new translations and removed pages are reflected immediately.
Alternate URLs may sit on different domains or subdomains, for example country-code domains, provided the site owner has verified each property. This makes the sitemap method particularly practical for international URL structures that span several ccTLDs.
Common errors and how to fix them
Most hreflang sitemap problems come from inconsistency between the sitemap and the live pages. Search engines read the annotations as hints, so conflicting canonicals, redirects or missing return references cause them to ignore parts of a cluster.
| Symptom | Likely cause | Fix |
|---|---|---|
| Missing return links reported | Alternate page lacks its own entry | Generate an entry for every member of the cluster |
| Wrong country version ranks | Invalid region code or missing x-default | Correct codes and add x-default to each entry |
| Annotations ignored | Alternate URL is canonicalized elsewhere | Point hreflang only to self-canonical URLs |
| Sitemap fetch errors | Missing namespace or file over size limit | Declare the namespace and split the file |
| Stale alternates | Static file not updated after changes | Automate generation in the publishing workflow |
A practical audit combines a crawler that parses sitemap hreflang, such as Screaming Frog, with spot checks of the international targeting signals in search results. The goal is a cluster in which every URL is canonical, reachable and reciprocal.
In simple terms
A hreflang sitemap is a list for search engines that says which pages are translations or regional versions of each other. Instead of writing this information on every page, the website keeps it in one file.
Think of it as a table of contents in several languages. When someone in Austria searches, the search engine can check the list and show the Austrian German page instead of the English or Swiss one.
A practical example
A software company runs its website in 14 language and country versions, from en-US and en-GB to de-DE, de-AT and ja-JP. Its marketing pages are built in a headless content system, and adding 15 link lines to every page head slowed releases and caused frequent template errors.
The development team moves all annotations into generated hreflang sitemaps, one file per section, each listing every localized URL with its alternates and an x-default pointing to a language selector. The files are rebuilt automatically whenever an editor publishes or removes a translation.
Within two months, Search Console reports far fewer hreflang errors, and users in Austria and the United Kingdom land more often on their own regional pages instead of the German or American versions.