Hreflang In a Nutshell

Hreflang In a Nutshell

If you’re used to multitasking and need a refresher on what Hreflang is/does (or if you’re completely new to the concept), please help yourself with the following video from Google before we get started:

A little background – I began working in the digital advertising industry fresh out of college in the late 2013. For the better part of my first year working in our digital agency, I focused most of my attention to mastering everything I could about the technical/content/data sides of SEO.

I consider myself rather lucky to have had the opportunity of working with a wide range of client accounts and projects that have SEO elements. Among them is our agency’s largest SEO account, in which the client’s website has about 10 different languages available in sub-directory folders. Naturally, the very first step to international SEO is in setting up multi-language websites the right way – one element of which is getting Hreflang implementation right.

Whether you’re working at the client side or agency side, I suggest you first get into your full researcher mode (if you haven’t already) about the topic of hreflang, as I am going to focus the following points mostly on my experience getting the hreflang implemented on a large multi-language website that has tens of thousands of URLs and close to a dozen languages.

Recommended Readings If You’re New:

1. Managing Stakeholders’ Expectations (Clients, Bosses, Subordinates)

Manage expectations, they say...

Manage expectations, they say…

In fact, this point is applicable to most SEO tactics that you’re going to implement for your clients because the right way to position Search Engine Optimization from the get-go is to make sure everyone who works with you understands that it is about influencing how a website appears in search engine result pages (SERPs).

Often times, your client contacts could get confused with the much more “control” marketers have over SERP appearances in Google Adwords. I’ve personally had experience with prospective clients who have very little understanding of how SEO works and likes to assume SEO professionals have control over how Google displays organic search results. Therefore, it’s absolutely crucial that we’re constantly educating them and getting them up to speed with the latest developments in SEO land.

If you look at the examples found in the Moz’s post, you’d realize that no matter how perfect your implementation is, there are always chances that you might not achieve the most ideal results, which is why it’s very important to make sure that all stakeholders are on the same page about the possibility of not getting it right at once.

The fun of implementing SEO is really the spirit of experimentation and continuously refining until you achieve your goals. Just make sure no one is gonna go crazy if you didn’t get it right the first time around.

2. XML Sitemap or HTTP Header / Meta Tag

Assuming you’ve read through all there is to know about Hreflang, it’s time to look at which method to go with. In order to help decide which way to go, you need to first thoroughly understand your client’s website, server and CMS architecture; of course you or your team should have all these information from the onboarding and the SEO site audit. For example, certain CMS might have either proprietary or third-party plugins that are capable of handling hreflang seamlessly and in such instances, all you gotta do is to communicate with the developers and check in the Webmasters Tool afterwards.

Joomla's Hreflang Solution

Joomla’s Hreflang Solution (Source: TemplateMonster.com)

Personally, I am a fan of XML Sitemap route since it’s very straightforward, whereas for HTTP header implementation, unless you’ve a CMS plugin to play around with, you’d need to make sure the meta tags are dynamic (example below) in order for the hreflang to work properly.

Something the developers need to know if you're going the Meta Tag route.

Something the developers need to know if you’re going the Meta Tag route.

The thing about HTTP Header – if you use NerdyData as mentioned in the Moz’s post to search for hreflang, you’d notice there are quite a large number of international websites using HTTP header implementation. However, it’s important to note that most of these websites are either social media sites or sites that require a user account to function (it makes sense to use HTTP header since you only need one page to be non-English search engine friendly).

Music Radar's Hreflang Example

Music Radar’s Hreflang Example

3. Which Sitemap Creator or Generator To Use

Say you’ve decided to go with the XML Sitemap route like I did, you first need to understand the current XML Sitemap structure on the site – whether it’s auto-generated by the CMS or the XML file is uploaded to the server’s root folder directly.

If your XML Sitemap is auto-generated by CMS and there’s no easy way to turn it off, I am afraid you’d need to explore all possibilities with the developers or go back to considering HTTP header method described in section 2 above.

In my client’s case, the .xml file is uploaded directly to the server’s root, so all I need to do is to communicate with my client contact what Hreflang does and what I am going to do with the website’s current XML Sitemap. I’ll try to describe the process in as many details as possible below:

Note: Step 1 and 2 were necessary in my case because my client already had a whitelist of URLs saved properly in the existing XML Sitemap file. If you intend to start from scratch, you could use Screamingfrog or Moz or any of the crawler tools to extract all the URLs of the website and go straight to Step 3.

Step 1 – The first thing I did was saving a copy of the XML Sitemap from the client’s website for backup and restoration purposes, in case things don’t work out. This is always important before you make any changes. Just go to www.example.com/sitemap.xml, and Ctrl+S to save the xml document.
Step 2 – Once I had the copy of the Sitemap, I opened it up in my Notepad++, copied all the URLs and pasted them into an Excel spreadsheet. Yes, the formatting will look weird but the point is to have a list of all URLs you want to include.
Step 3 – Filter, sort or do whatever you need to segment out the multiple variants of the main URLs in different columns. Your spreadsheet should have the final format as below:

Excel - SEO's BFF

Excel = SEO’s BFF

Step 4 – Keep only one worksheet in that file and save it as .csv file. The Media Flow’s Hreflang Tool is really handy in generating Hreflang XML Sitemaps and I use it all the time. As you can see on the website, the file format that’s required to work with the tool is exactly as I described in the previous step.

Note: What if the website has sections/sub-directories that do not have other language variants, you ask? Well, fret not and carry on with generating your Hreflang Sitemap with The Media Flow’s tool using multilingual subdirectory URLs ONLY.

Step 5 – For the rest of the URLs with no matching multilingual URLs, just make sure you keep them back in the old format without Hreflang value – I use Notepad++ and Excel to sort through my URLs. If you’re starting from scratch as I mentioned at the beginning of this section, you may want to first generate a normal Sitemap using one of those online XML Sitemap tools, filter out all language subdirectory URLs, keeping only the URLs that have no other variants and save the file as sitemap1.xml or anything you wish really.

4. Organize Sitemaps Using Sitemap Index

If you did follow my instructions in the previous section, now you either end up with one XML Sitemap file with Hreflang value or TWO XML Sitemap files – one with Hreflang value and one without.

All you need to do is to upload both files to the server’s root, submit in Google’s Webmasters Tool and wait 24-48 hours for them to refresh.

However, if the website you’re working with is huge and you could use a little sitemap management with Sitemap Index that lists all the XML Sitemaps. There are many ways you can go about doing this – in my case, I only keep to two XML Sitemaps at the end, so the Sitemap Index file looks kinda like this:

Sitemap Index

Sitemap Index (for illustration)

You could name your Sitemap files anything you want of course. So, the upload process is WithoutHreflang.xml, WithHreflang.xml and then Sitemap.xml. Afterwards, you need to double check your Robots.txt file to make sure it’s listing the Sitemap Index file – in my case Sitemap.xml. And then, it’s about submitting in Google’s Webmasters Tool.

Another reason to consider using Sitemap Index is that your Hreflang Sitemap file is not going to render in a normal structured format seen commonly in most XML Sitemaps. My speculation is that it has to do with the xhtml namespace you need to declare in order to build a Sitemap that supports Hreflang – xmlns:xhtml=”http://www.w3.org/1999/xhtml”. So, it’s absolutely normal if your final product ends up rendering like this in browser:

If that's your main file, some clients may not like the rendering - one more reason for Sitemap Index.

If that’s your main file, some clients may not like the rendering – one more reason for Sitemap Index.

More about Sitemap Index – https://support.google.com/webmasters/answer/75712?hl=en.

Additional note: if the website you’re working with has multiple sections with a ton of content in each of them, you may also consider breaking your Sitemap files by sections, for example, www.example.com/1 and all variants of it can be in one sitemap and www.example.com/2 and all variants of it can be in another. This is completely optional though, unless you’ve more than 50,000 URLs in your Sitemap or the file is larger than 50 MB, in which case it’s mandatory that you break your Sitemaps up by sections.

Oh, don't you love quick answers...

Oh, don’t you love quick answers…

5. Check in Google’s Webmasters Tool and Troubleshoot

As I mentioned, it could take anywhere from 24 – 48 hours or even longer in some cases for your Hreflang in Sitemaps to be picked up by Google, so take it easy for a couple of days after submitting your fresh new Hreflang Sitemaps in Google’s Webmasters Tool.

After you’ve gone through the implementation, this part isn’t going to be so much of a headache, as it’s just a matter of regularly monitoring and checking into the health of your URLs, just like you would as an SEO analyst/executive/manager any other day.

In the midst of sorting these out...

In the midst of sorting these out…

This is my first attempt at writing about a topic that is very pervasive among the SEO communities everywhere and yet every now and then I’ve seen a lot of fellow SEOs struggling to get started on the Hreflang implementation. I am not saying my implementation was perfect – in fact, there is still a long long way to go before I can get all these errors sorted out. It’s imperative to keep monitoring and testing to influence the correct sub-directories eventually showing up in respective search engine markets. Regardless, I feel that it’d be beneficial to share my experience so that we can all learn. Please feel free to reach out to me at richxiong@gmail.com or on Twitter @richxiong if you’ve any questions about Hreflang, any feedback on this post or if you want to talk about SEO in general. Cheers!