What is the Rel=”Alternate” Hreflang specification?
Google uses the Hreflang specification to understand and serve the best URLs for regional and language based queries.
This means that if you have websites or resources targeting specific languages or regions you can use the specification on your website to tell Google the best URLs to serve.
Let’s give a practical example: a British company that operates a sales operation and website in the UK, the United States, and in Germany.
This company wants its customers in each country to go to the correct website for their location – though it also wants all general English visitors to go to the UK website, and all German speakers to go to the German website.
You might use on-page markup in the following way on a resource:
<link rel="alternate" href="https://www.example.co.uk/" hreflang="en-gb" /> <link rel="alternate" href="https://www.example.com/" hreflang="en-us" /> <link rel="alternate" href="https://www.example.de/" hreflang="de-de" /> <link rel="alternate" href="https://www.example.com/" hreflang="en" />
<link rel="alternate" href="https://www.example.com/" hreflang="x-default" /><link rel="alternate" href="https://www.example.de/" hreflang="de" />
Note that you should not include a country code on it’s own. Google will not automatically work out which language you are targeting if you specify a country, so always make sure to include a language.
Ways of Implementing Rel=”Alternate” Hreflang
There are three ways of implementing Rel=”Alternate” Hreflang:
Add the information in the <head> section of a webpage using link elements.
If implementing with on-page markup is problematic you can use a HTTP header instead.
Another alternative that may be useful for large websites is the ability to implement the Hreflang specification inside sitemaps.
What is the Rel=”Alternate” Hreflang Code for UK Sites
The country code for the UK is GB – not UK. This is a common mistake websites make (be careful!).
If you were targetting the UK you would use en-gb which specifies English as a language and the UK as a region.
<link rel="alternate" href="http://example.co.uk/" hreflang="en-gb" />
No, using the Hreflang specification does not share link authority. You can read more on this here.
Hreflang Language & Country Codes List
To find the appropriate language code the list to check is ISO 639-1.
The region code uses ISO 3166-1 Alpha 2.
As part of the specification websites can include a fallback for unmatched languages using the following format:
<link rel="alternate" href="http://example.com/" hreflang="x-default" />
This is especially needed on auto-redirecting homepages.
Is Rel=”Alternate” Hreflang A Directive or a Signal?
Href is treated as a signal by Google not a directive, which means that if other factors indicate another URL would provide a better result Google may serve this page instead.
Need help with international SEO?
Find all this confusing? It is complicated stuff, but no problem. Get in touch and we can help out with your HrefLang tags or provide international SEO consultancy.
Content last checked for accuracy and updated: 25th August 2020, by Colin McDermott