Hreflang
By Thibault · Updated
Hreflang is an HTML attribute that tells Google which language and regional versions of a page exist, so it can show each searcher the version made for their language or country.
Why does hreflang matter?
Hreflang stops Google from showing the wrong language version of your page to a searcher. Without it, a French visitor can land on your English page, or your page for the United States can rank in the United Kingdom, where prices and spelling do not match. Google says the annotation helps its results link to the correct language version of a page. It sorts out which of your pages gets shown. It does not make a weak page rank.
How does hreflang work?
You declare every version of a page, and each version lists all the others plus itself. Google accepts three equivalent methods: link tags in the HTML head, HTTP headers (useful for PDFs), and XML sitemaps. The value combines a language code in ISO 639-1 format, like fr, and an optional region code in ISO 3166-1 Alpha 2 format, like fr-CA. A region code can never stand alone. The reserved x-default value names the page to show when no other version matches the user's browser language.
- Each version must list itself and every other version.
- Links must go both ways: if page A points to page B, page B must point back to page A, or Google ignores the annotations.
- Every URL in the set must be the canonical, indexable version.
- Add an x-default for visitors who match no version, often a language selector or your main version.
An example of hreflang
A site has a page in English for the US, English for the UK and French. Each of the three pages carries the same block in its head: one link with hreflang="en-us", one with hreflang="en-gb", one with hreflang="fr", and one with hreflang="x-default" pointing to the US page. The block is the same on all three pages, which is exactly what makes the return links valid.
Frequently asked questions
Is hreflang a ranking factor?
Hreflang does not push a page up the results. It helps Google pick which of your language or regional versions to show to a given searcher. The gain comes from showing the right page to the right audience.
What happens if hreflang return links are missing?
Google states that if two pages do not both point to each other, the tags will be ignored. Every page in the set must list all the other versions and itself.
Should I use HTML tags or an XML sitemap for hreflang?
Google treats the three methods as equivalent. On a large site, I prefer the XML sitemap because it keeps everything in one file and avoids weighing down each page. Pick one method and stick to it.
