Skip to content
International 3cab245

Using the Correct Hreflang Tag: A New Generator Tool

Aleyda Solis

The author's views are entirely their own (excluding the unlikely event of hypnosis) and may not always reflect the views of Moz.

Table of Contents

Aleyda Solis

Using the Correct Hreflang Tag: A New Generator Tool

The author's views are entirely their own (excluding the unlikely event of hypnosis) and may not always reflect the views of Moz.

You may also like:

One of the challenges that International SEOs face is correctly targeting the right web presence to the appropriate search audience. Let's start with a couple of scenarios with these challenges so you can see clearly what I'm talking about.

If I search from a Mexican IP (using a Proxy service, to simulate being in Mexico) in Google Mexico for "comprar zapatos en linea," which in English means "buy shoes online" I get the following results:

Non Aligned GeoRanking Results

As you can see, Dafiti has a Mexican website version that is ranking no. 1, which is relevant in this case; but also has a Colombian version ranking no. 3 and an Argentinian version ranking no. 7. All of them are using ccTLDs, which should "ideally" give geolocation signals to Google. Additionally, there's a Spain site ranking no. 2 called Sarenza, also using a ccTLD.

Here's another example, this time for a couple of branded searches, first only for the brand, "edreams" in this case, which is a popular travel site with a strong international presence and then for "vuelos edreams," which in English means "edreams flights:"

Branded Results with Non Aligned Georanking Results

In the previous image you can see how:

  1. For its brand name results, despite being searched from Google Mexico with a Mexican IP, the first result is actually the Spain web version and the second is the American one! The Mexican web version—the relevant one for this location—is ranked third.
  2. For the "vuelos edreams" branded search, the Mexican web page version ranks first (yay!) but the second result shows a webpage that belongs to their Spain site.

How can you identify that you have an international search results alignment issue like the ones shown above?

The easiest way is to take a look in Google Analytics at which countries your organic search traffic is coming from, by going to the "Audience > Demographics > Location" report (along the appropriate organic search segment) and identifying which landing pages and keywords are bringing those visitors. You can do something similar with the language, with the "Audience > Demographics > Language" report.

You can also verify potential misalignment issues of any website, by checking their top rankings in the different Google international search results (not only your own but any site, which is great if you want to analyze the competition) by using Search Metrics and SEMRush. For example, checking the rankings of the Spain version of eDreams in Google Mexico:

SearchMetrics Domain Results per Country

What can we do to prevent those issues? How can we avoid ranking with the incorrect web version in some international search results, or cannibalizing them with many non-relevant Web versions? How can we provide a relevantly targeted web version to the right international audience?

The rel="alternate" hreflang="x" annotation came to the rescue, initially released at the end of 2011 and updated in April of this year to support the x-default value. It's used by Google (and Yandex too) to correctly identify the language and the country targeting of web pages, that can include them as a link element in the HTML head area, in the HTTP header or XML sitemap.

HrefLang tag specifications by Google

So why can we still see the misalignment issues in international search results, as the ones shown in the previous examples?

From my experience, most of the time Google does a good job in these scenarios when the hreflang annotations are correctly included. You can take a look at:

Nonetheless, many sites are still not making use of the hreflang annotations. Some of the issues I've seen come from the fact that sometimes we don't correctly use the hreflang annotations.

Take a look at the number of questions about hreflang in the Moz Q&A Forum and Google's Internationalization Webmaster Forum; there are still clearly many doubts about how to use it.

One of the error scenarios is the misuse of the hreflang link element by including non-supported values, especially for the region, in the HTML's <head> area. Google specifies in its official documentation that they support the ISO 639-1 format for the language, and optionally the ISO 3166-1 Alpha 2 format for the region.

Let's use the web code search engine Nerdy Data to find sites that, instead of including the "en-gb" value to specify that a page is in English targeting the UK (since the ISO 3166-1 Alpha 2 code for the UK is "GB"), are mistakenly including "en-uk":

HREFLang Error - Country attribute: UK instead of GB

Or, as another example, pages that are including "en-eu" to specify they're in English and targeting to the European Union (the "EU" code in this case is not supported, since regions are limited to countries):

HREFLang Error - EU is not supported

You can see more specifically the case of Hollister—that was shown in both of the previous cases in the Nerdy Data results—how they're targeting the UK with the "en-uk" value and also, for their general English, German, French, Italian, and Spanish versions targeting to the European Union, they add the "eu" value for the region, which is not supported:

HREFLang Error - EU and UK values

As you can see, although we already have a couple of tools that facilitate the hreflang validation and its inclusion in sitemaps (check out the hreflang validator from DejanSEO and the hreflang sitemap tool from the Media Flow) it would be useful to have another, even simpler tool, that would serve to generate the required hreflang tags according to the languages and countries, thus helping us to avoid the previous issues.

To fill this need, I've published the hreflang tags generator tool:

Hreflang tag generator tool

The tool's goal is to assist you in the generation of the correct hreflang annotations for the different language or country versions of a specific page. You will need to place these in the HTML <head> area of each of its URLs, and that will serve as a reference to generate the rest of the hreflang tags for all of your site pages, with the correct syntax and formats.

When you generate the hreflang annotations the tool allows you to copy/paste the results or download them as a CSV file, so it's easier to use than other tools, too:

hreflang tag generator results

This is only the first version of the tool, and I'm already planning to include more functionality to assist with hreflang annotation generation on a massive scale. If you find any issues with it, or any feedback or ideas, please contact me via Twitter or send me an email at aleydasolis at gmail.

I hope the tool, although very simple, can be helpful to clarify the doubts about how to generate the correct hreflang annotations in your specific case. If you have any questions, please let me know in the comments!

Back to Top
Aleyda Solis

Aleyda is an International SEO Consultant -service that she provides with her company Orainti, a boutique SEO consultancy-, speaker (with more than 70 conferences in 18 countries in English and Spanish) & published author ("SEO, Las Claves Esenciales"). She has more than 10 years of experience doing SEO processes for European, American and Latin-American companies. You can connect with her in twitter or her website.

With Moz Pro, you have the tools you need to get SEO right — all in one place.

Read Next

International SEO — Whiteboard Friday

International SEO — Whiteboard Friday

Sep 20, 2024
Build a Business Case to Get an International SEO Investment Approved for 2024

Build a Business Case to Get an International SEO Investment Approved for 2024

Dec 06, 2023
Going International: 15 SEO Steps for a Successful Expansion

Going International: 15 SEO Steps for a Successful Expansion

Aug 08, 2022

Comments

Please keep your comments TAGFEE by following the community etiquette

Comments are closed. Got a burning question? Head to our Q&A section to start a new conversation.