# hreflang sitemap

Category: [International SEO](https://seo-geo-glossary.com/en/glossary/category/international-seo/) › [hreflang & language tags](https://seo-geo-glossary.com/en/glossary/category/international-seo/hreflang-language-tags/) · Also known as: hreflang in XML sitemap

**hreflang in an XML sitemap** is one of three ways to tell Google about language and country versions of a page. Instead of the HTML head, the links sit in the sitemap as `xhtml:link` entries for each URL.

## How does it work?

The sitemap needs the namespace `xmlns:xhtml="http://www.w3.org/1999/xhtml"`. According to Google, each `<url>` element must contain a child `<xhtml:link rel="alternate" hreflang="...">` for every alternate version, including the page itself. Each language version gets its own `<url>` block with the same set of links, so the versions confirm each other.

The method helps when the HTML head is hard to change or when the links are generated from central data. Errors become visible in the sitemap file or in testing tools rather than on the page. According to Google, the `xhtml:link` child elements do not count toward a sitemap's URL limit, and using several methods at once brings no benefit.

## Example

```xml
<url>
  <loc>https://example.com/en/page/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/page/"/>
  <xhtml:link rel="alternate" hreflang="de" href="https://example.com/de/seite/"/>
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/"/>
</url>
```

A second `<url>` block for `https://example.com/de/seite/` holds the same three links.

## Common mistakes

- A version is missing or does not link back
- The page does not list itself
- Language and region codes in the wrong order, such as the region first

*Diagram: hreflang cluster with return links.* Four language versions of one page. Each lists all versions, including itself. de-AT does not list en, so Google ignores the one-way link from en to de-AT.

## Related terms

- [XML sitemap](https://seo-geo-glossary.com/en/glossary/xml-sitemap/index.md)
- [hreflang](https://seo-geo-glossary.com/en/glossary/hreflang/index.md)
- [hreflang return tag](https://seo-geo-glossary.com/en/glossary/hreflang-return-tag/index.md)
- [x-default](https://seo-geo-glossary.com/en/glossary/x-default/index.md)
- [Sitemap index](https://seo-geo-glossary.com/en/glossary/sitemap-index/index.md)

## Sources

- [Tell Google about localized versions of your page – Google Search Central](https://developers.google.com/search/docs/specialty/international/localized-versions)
- [hreflang sitemap – Weglot (secondary)](https://www.weglot.com/blog/hreflang-sitemap)
- [XML sitemap with hreflang tags – seoClarity (secondary)](https://www.seoclarity.net/blog/xml-sitemap-with-hreflang-tags)

---

Last updated: October 8, 2026
URL: https://seo-geo-glossary.com/en/glossary/hreflang-sitemap/
