How to use Hreflang correctly (2018 edition)

Disclaimer: because of the complicated nature of hreflang, I deliberately decided that was better not using always a too “technical” or “academic” language or definitions. Therefore, I ask the purist of SEO to close an eye and forgive me because of my desire of seeking a better comprehension of this convoluted topic also by a wider and technically less educated public.

A few weeks ago, John Mueller of Google published a tweet that surprised quite many SEOs:

More recently, then,Rand Fishkin asked for helpabout a specific use of hreflang, and that tweet led to quite a storm of answers, questions and doubts during the day.

Inspired by the return of interest that hreflang has been having lately, and becauseI still see a lot of confusion about it and how to implement it correctly, I decided to return writing on my blog.

In this post, I will try to resume the most important things we know about how to use use the hreflang mark up, what are the most common error and answer to the most frequently asked questions, backing their answers with official communications by Googlers.

Let’s begin.

THE BASICS OF HREFLANG

Hreflang=”x” is an attribute that indicates to Google (and others search engines) what URL serves the users speaking a given language and – if explicitly indicated – a given country (hreflang=”x-X”).

For instance, if domain.es targets Spanish-speaking users in Spain and domain.co.uk targets English-speaking ones in Great Britain, then the following hreflang annotations will specify these intents to Google:

However, Google advises us that there is an exception to point 3: in fact, we can use the ISO 15924 for indicating that we are using a specific language script on our page and that we can use this ISO code in combination with a country one.

This means that it is totally correct having an hreflang like hreflang=”zh-Hans” for telling Google that we are using Simplified Chinese instead of Traditional Chinese (zh-Hant).

What does happen if we do not use the correct ISO codes in hreflang?

It will happen that Google won’t consider the hreflang with the wrong ISO code but still consider the correct ones in same hreflang annotations set (source).

When should we use hreflang?

When our website has fully translation version (i.e.: www.domain.com is in English and www.domain.com/es/ is its Spanish version);

When our website as different versions in the same language and targeting different countries, hence there are very slight difference mainly due to localization (i.e.: www.domain.com is the American-English version of our website and www.domain.co.uk is the British-English one);

When we offer the same content to different audiences but:

the main content is always in the same language despite the specific version is targeting an audience using a different one;

the template is translated into the language used by the audience we are targeting;

and/or the page has UGC content in the language used by the audience we are targeting;

This last case – as Google says – may happen in websites like forums… and it is a first clear example of how hreflang can be convoluted.

how to implement the hreflang annotations

Hreflang is a single URL based signal, therefore it must be implemented URL by URL.

Some people say that the self-referential hreflang is not needed… Google explicitly says it must be used:

“If you have multiple language versions of a URL, each language page should identify different language versions, including itself.” (here, again).

Mistake #2 – forgetting the return hreflang annotation

If the Spanish URL A suggests URL B as its alternative German version, then URL B must suggest back URL A as its alternative version for Spanish-speaking users.

If this rule is not respected, Google will not consider the hreflang set as correct, hence it will ignore it.

Mistake #3 – Using URLs, which doesn’t respond with 200, in the href element of the hreflang annotation

Pay attention to the server response code of the URLs you are indicating in the hreflang set.

If they respond with 4XX, 5XX and 3XX server message, then we will be breaking the return rule, therefore the hreflang will be considered incorrectly implemented (no-return error).

Mistake #4 – Using URLs, which are blocked via robots.txt, in the href element of the hreflang annotation set

If the alternative URL is blocked via robots.txt, then Google won’t be able to access the code of the page, therefore won’t see the hreflang set implemented there. We will have – once again – a no-return error message.

Formally, if we did this kind of mistake, but implemented the hreflang via sitemaps.xml, we won’t see any error in Google Search Console. This doesn’t mean that this is something intelligent to do.

Mistake #5 – not using canonical URLs in the href element of the hreflang annotation set

Mistake #8 – targeting too many useless countries with hreflang

Google suggests avoiding what could end up being a potentially chaotic and catastrophic implementation.

It is better, Instead, to start implementing language/country hreflang annotations for targeting only those markets that really matter to our business.

If then, we want to target also other countries, which share the same language of a version we already have, then we can consider the opportunity to use the language only kind of hreflang annotation.

mistake #9 – Messing up with the language and country iso codes

Even if the ISO Code language and country pairs are maybe the easiest things to understand of hreflang, nevertheless there’s still a lot of people messing up with them and doing these mistakes:

Using the incorrect country ISO Code (i.e.: hreflang=”en-UK” instead of hreflang=”en-GB”);

Using the incorrect country ISO Code (i.e:: hreflang=”eng-GB” instead of hreflang=”en-GB”);

Using both incorrect language and country ISO Codes (i.e.: hreflang=”eng-UK” instead of hreflang=”en-GB”);

Using only the country ISO Code (i.e.: hreflang=”GB”);

Inverting the order of the ISO Codes (i.e.: hreflang=”GB-en” instead of hreflang=”en-GB”):

Most recurring doubts about hreflang answered by Google(rs)

Is the hreflang a ranking factor?

No, absolutely not!

What the hreflang does is swapping out URLs in the existing rankings.

For instance, if www.lapepica.es was ranking in position 5 in Google Mexico for brand searches because of being a stronger domain than www.lapepica.com.mx, implementing the hreflang will make that the www.lapepica.com.mx URL will substitute www.lapepica.es in Google.com.mx, and not to miracously jump to position 1.

Can JavaScript block Google’s view of hreflang?

Be aware that this problem may affect also rel=”canonical”, as Gary Illyes statedhere.

A practical solution for avoiding this problem – apart not using not allowed tags in the <head> section of the page – is presenting all the meta tags and annotations like rel=”canonical” and hreflang very high in the coding.

What is the hreflang “x-default” and how must we use it?

For homepages that dynamically alter their contents based on a user’s perceived geolocation or the Accept-Language headers

However, and this is a classic example used by SEO to ask Google to update its Help Pages about International targeting and Hreflang, it is a very common practice to use the hreflang=”x-default” also to indicate what page Google must present to all those users that are not targeted by a specific language version.

For instance, we have a website in targeting the main European countries, but we want Google to present the English version URLs to those users living in countries like, for instance, Sweden, whose language we don’t serve in our website.

In this particular case, using hreflang=”en” would not be the correct solution neither hreflang=”en-SE” because: with any of those 2 solutions we are targeting Swedish-speaking users.

Instead, as it has been proved by many SEOs and with particular issues, annotating all the English URLs also with the hreflang=”x-default” seems to be the correct solution for targeting – following up with my example – the Swedish-speaking users with our English version URLs, which is important for branded searches.