Hreflang Tags Not Respected (How to Solve) 1

Hreflang Tags Not Respected (How to Solve)

Today we have a guest post. Tom Blackshire was supposed to be speaking at ohgmcon about tasteful cloaking opportunities to steer Googlebot and enhance website visibility. Unfortunately he had a crisis of faith over whether cloaking was right or wrong and was unable to attend. As penance, he’s agreed to write this unrelated post on a technique he introduced me to. I’ve included my recent experience as an afterthought. You can check out his Wix website here. Thanks Tom!

 


Hreflang Not Working

A few years back, I was consulting for a website you probably went on today. They had international versions for one of their programs, and targeted a number of different countries. We had implemented hreflang tags in the <head> of the page; Google Search Console showed us that it could see them in a fetch and render.

However, the hreflang was not respected, Google Search Console also told us that hreflang tags were missing.

We could have implemented in a sitemap.xml, but reasons™ that I can’t remember meant this wasn’t an option. We tried absolutely everything to get this work, my suggestions progressed from logical to fairly out there.

In the end, I punted that the significant amount of in-line JavaScript might be doing Something™ to the hreflang tags when Google rendered the page.

I somehow got the development to buy this theory and move the hreflang above the in-line JavaScript in the <head>, and the directives were respected.

Wat.


Thanks Tom. Hello again, it’s me. Tom had mentioned his experiences to me in an earlier discussion, but he also sent me this from Nicholas Chimonas on slack:

Hreflang Tags Not Respected (How to Solve) 2
This is essentially a tl;dr for the post.

That was enough for me. I was working on a ecommerce site having international ranking issues. Here are the facts:

  • The site was using a <head> implementation for hreflang. The tags were delivered with the HTML, and not via later injection (e.g. GTM, AJAX).
  • The hreflang configuration was correct and consistent. The correct countries and formatting were being used, and there was no HTTP header or XML Sitemap configuration.
  • The hreflang implementation was just before the closing tag of the head, and following a <noscript> implementation of GTM.
  • The site did not have significant crawl issues. All category pages were being requested.
  • Google was only picking up a small number of hreflang tags across all Search Console accounts.
  • Developer Tools, Fetch and Render, the Structured Data Testing Tool, Google Translate etc would all show the hreflang tags in place as expected, without formatting issues.

Implementing the recommendation to move the hreflang higher is one of those things that felt like a long shot (see: cloaking your browser version popups) but I pushed it because of gut. I will write about the reasons™ in a future post (you’ve probably guessed them by now).

UPDATE: I’ve written about the reasons.

How to Fix Hreflang Not Working

The change was prioritised last in the development queue as a result of being a long shot, so made it into a separate sprint. The only SEO change in that sprint was moving the hreflang higher than any scripts in the <head>. Then as if by magic:

hreflang en-us

Hreflang Tags Not Respected (How to Solve) 3

Hreflang Tags Not Respected (How to Solve) 4

Can you guess the date the change went in?

Just because an implementation is correct™ and validates in tools, doesn’t mean it works™.

If you liked it, tweet it.

2 thoughts on “Hreflang Tags Not Respected (How to Solve)”

Leave a Reply

Your email address will not be published. Required fields are marked *