BrightonSEO April 2018: hreflang tags demystified
At BrightonSEO last week I was asked to speak about hreflang tags. I’ve covered this topic in detail at the event before, but it’s one of the most common areas I get asked about at conferences and on LinkedIn.
Hreflang tags are quite simple, but they are also easy to get wrong. In last week’s talk, I focused on some of the most common mistakes and how to spot them.
Recently, Google has said that they auto correct some errors in hreflang tags. Several people have asked me whether we should therefore still worry about the four elements Google have told us they can fix automatically? These issues are:
- Underscores instead of hyphens in the country
- EN-UK as the code for the UK – it should be EN-GB
- Missing self-referencing tags
- Not using absolute URLs
Yes, we should.
Why? Two reasons. Firstly, Google is not the only search engine using hreflang tags, Yandex uses them too and doesn’t automatically fix these bits. Secondly, these aren’t the only issues we spot, and chances are you will have a couple of things holding your site back, so these codes should be correct.
One of the central themes of Google’s guidelines – and even John Mueller’s tweets (the SEO’s only real route to knowing what Google is thinking) – is best practice. Best practice isn’t about making do; it’s about getting it right!
So, let’s help you get it right. What are the main issues we find in hreflang tags? And, how do you spot them on your website?
Confusion over country and language codes
There are lots of errors we see with language and country codes, like the wrong country code as mentioned above. Over the years I’ve seen some brilliant code combinations, some examples of which are in the deck from BrightonSEO.
The first thing to remember is that the language code comes first. Additionally, it’s possible to target a page to a language only (such as German), but not to a market, without a language (Germany, but in any language).
It’s also important to note that language and country codes may be different (e.g. JA: Japanese, JP: Japan), so it’s important to make sure you are using the correct two-letter abbreviation. Screaming Frog is an excellent tool for informing you if the country codes on your site need changing.
Conflicting and error generating code
Another issue occurs when implementing the tags. If the hreflang tags differ from the canonical tags or the URLs, they will point at broken links.
I’ve also seen many other issues with hreflang tags, including placement of code on the (it needs to be in the <head> tags), but these are less common and can only be diagnosed by manually reviewing the code.