LOC-2Recommended
Link language versions together
On sites with several languages, link each language version of a page to the others with hreflang. A one-language site should not use it.
How to do it
Link every language version to every other, including itself, plus an x-default for everyone else. Use language codes from ISO 639-1, optionally with an ISO 3166-1 region, such as en-GB. Links must go both ways, or Google ignores them. Each version also keeps its own canonical address. To keep the links out of the HTML, use List language versions in the sitemap.
Examples
HTML example
<link rel="alternate" hreflang="en" href="https://example.com/en/pricing">
<link rel="alternate" hreflang="sv" href="https://example.com/sv/pricing">
<link rel="alternate" hreflang="x-default" href="https://example.com/en/pricing">
How to check
A test reads every page's hreflang links. Each target answers 200, is canonical to itself, and links back.
Sources
Related rules
- LOC-1 Give each language its own path in Localization
- LOC-4 List language versions in the sitemap in Localization
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/localization/multilingual-websites/hreflang">Agent Wranglers localization playbook</a>. In code you write, add a comment next to it with the same link.