hreflang
Definition: hreflang is an attribute that tells search engines which language and regional versions of a page exist, so each user can be shown the version that matches their language or country.
Also called: hreflang tags, rel=alternate hreflang, x-default
Updated
Three ways to declare it
Google says you can declare language and regional alternates in HTML link elements, in HTTP headers, or in your XML sitemap, and that the methods are equivalent (localized versions of your pages). Pick one per page type and use it consistently.
<link rel="alternate" hreflang="en-us" href="https://example.com/us/">
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/">
<link rel="alternate" hreflang="de" href="https://example.com/de/">
<link rel="alternate" hreflang="x-default" href="https://example.com/">
The rules most implementations break
- Every version lists every version, including itself. The block above belongs on all four pages.
- Return links are required. If the US page points to the UK page, the UK page must point back. One-way annotations may be ignored.
- Codes must be valid. Language uses ISO 639-1 (
en,de), the optional region uses ISO 3166-1 alpha-2 (gb, notuk).en-ukis a common error. - Each URL should be canonical. An alternate that canonicalizes to a different language version cancels itself out.
- Use
x-defaultfor the page shown when no listed language or region matches, such as a language picker or the global home page.
What hreflang does not do
It does not merge ranking signals across versions, and it does not fix thin or duplicated translations. It only helps the search engine swap in the right version for each user. Two English pages for the US and UK that are otherwise identical can still be treated as duplicates, so localize prices, spelling, contact details and examples.
The hreflang checker validates codes and return links across every alternate on a page.