Hreflang
Hreflang is an annotation that tells search engines which language or regional version of a page to serve to which user. It can be delivered via `<link>` tags, HTTP headers, or XML sitemaps. Bidirectional references are mandatory — each version must reference all the others.
Long definition
Hreflang annotations pair a URL with a language-region code (e.g. en-US, es-ES, de-CH). The codes follow ISO 639-1 for language and ISO 3166-1 Alpha 2 for region; the region is optional.
Three delivery methods are supported, and you should pick one and stick with it:
- HTML
<link rel="alternate" hreflang="..." href="...">in the page's<head>. Simple but scales poorly past a handful of locales. - HTTP headers — same idea, for non-HTML files (PDFs, for example).
- XML sitemap — the only method that scales cleanly for large multilingual sites. Each URL entry includes a
<xhtml:link>child for every alternate.
The x-default value marks the fallback URL when none of the declared locales match the user's language or region. It's required when you have a multilingual/multiregional site and want to control what appears for users outside your declared markets.
Bidirectionality is strict: if /es-es/product references /en-us/product as the en-US alternate, then /en-us/product must reference /es-es/product as the es-ES alternate. Unidirectional hreflang is ignored silently.
Common misconceptions
- "Hreflang is a ranking signal." It isn't. It's a targeting signal that reshuffles which URL from your site is shown to which user. The ranking is still driven by the usual signals.
- "Hreflang replaces canonical." They do different jobs. Each locale URL should have a self-canonical and hreflang alternates to every other locale. Cross-locale canonicals break hreflang.
- "
en-EUis valid." Region codes must be actual ISO 3166 countries. There is noEU. Useen(language only) or a specific country. - "Sitemaps and tags can coexist." They can, but you'll chase bugs when one drifts from the other. Single source of truth wins.
Continue exploring