Building a reciprocal set of localized URLs
hreflang works only as a complete set. Each language version must list itself and every other version. Annotations must be reciprocal: if two pages do not point to each other, Google ignores the tags. Alternate URLs must be fully qualified, including http or https; protocol-relative or relative paths are not accepted. Because every version lists every other, adding or removing one locale changes the annotations on all of them. So a multi-locale CMS migration has to check the whole set, not single pages.
Language and region codes
The value starts with an ISO 639-1 language code, optionally followed by an ISO 3166-1 Alpha 2 region code (for example
en-US).A country code alone is invalid; the language code must come first.
Codes outside those ISO lists, such as
es-419, are not supported by Google.Reserved codes like
UK,EUorUNhave no effect in Google Search; the United Kingdom region code isGB.
The reserved x-default value marks the fallback page for users whose language settings match no listed version.
What Google infers and what hreflang must state
Google does not use hreflang or the HTML lang attribute to detect a page's language; it uses its own algorithms. Google does not infer the target audience from language subdomains in the URL; hreflang must map it explicitly.
Canonicals and translations
When using hreflang, each page's canonical should point to a page in the same language.
Translated pages are not duplicates; localized versions count as duplicates only when the main content stays untranslated.
When two versions share a language but target different regions, such as US and UK English, Google advises pairing hreflang with canonicalization.
For running localized content from a CMS, see headless CMS development for marketing teams; for hreflang and other SEO checks in a CMS move, see the headless CMS SEO migration guide.
Sources
- Tell Google about localized versions of your pageGoogle · developers.google.com
- How to specify a canonical URL with rel="canonical" and other methodsGoogle · developers.google.com
- What is URL CanonicalizationGoogle · developers.google.com