Tag Hreflang: what it is and how to use it in websites for different languages and countries

Google Website Builder: New tool for small businesses to create their sites for free
After all, has SEO died or not died?

Hreflang is an alternate tag, included in the code of the pages of a website to indicate to Google that content has versions in different languages ​​and / or different countries. Its use is important to indicate the most appropriate content for Google.


I do not know if you know, but for some time we launched our blog in Spanish , which already has more than 300 publications!

It has very unprecedented and unique content there, but also made the translation of several posts we have here, making some adjustments to the reality of other countries.

As the translated posts were being published, we note that in many situations the publications ended up competing with posts in Portuguese, even for research in Spanish in other countries.

To resolve this and other problems, we use the rel = “alternate” hreflang . Have you heard?

Rand Fishkin (former Moz) SEO  from all over the world responded several ways to do this, but the most appropriate action was: use the hreflang tag and link to the original post .

 

When researching the impact of the use of tags, some posts (as of Branded3  and Seer ) stated that the use of hreflang tags generates a positive impact on the indexing of content and consequently on its results .

Before detailing what it is and how to use, it is important to remember that the use of hreflang tags:

  • Help the version of country / language right from the pages appear in the correct versions of Google:  the Spanish version on Google in Spanish, the English version on Google in English , and so on;
  • Will not replicate the positioning to other countries:  just because we are well positioned to “Landing Page” in Brazil, does not mean that applying the tags we will also be in that position in other countries;
  • Will also not correct duplicate content : if we have nearly identical pages in Portuguese for Brazil and in Portuguese for Portugal, the hreflang will not determine which should have a better position (in this case, factors such as authority and “old” content will have more Weight). Here it is stated we use the tag canonical  pointing to the version we consider the main.

What is the hreflang tag and how to use it the right way

If you have never heard basically the hreflang is a tag  rel = “alternate”  that tells Google language options (and country, if configured) of certain content.

You can apply it in 3 ways:

  • HTML tag pages, inside the <head>;
  • GET HTTP header response;
  • Sitemap languages.

Of the options, the two most common ways to apply are the HTML tag and the use of sitemaps .

How to apply the hreflang tag in the HTML of the page

First of all, to apply the tags in HTML correctly, all the pages involved must have the code within the <head>, configured correctly.

Each page should have a line of code with the following structure:

<Link rel = "alternate" href = "https://exemplo.com/portugues-brasil/" hreflang = "en-us" />

Note that, in the end, has an acronym indicating the language (in this case, Portuguese) and another acronym indicating the country (in this case, Brazil). If you want to not target to a specific country, just include the language acronym.

The language abbreviation is used in the format ISO 639-1  and the symbol of the region (which is optional) is in the format ISO 3166-1 alpha 2 . A very common mistake in the configuration is to insert the symbols incorrectly.

It is important to also include a “default tag” indicating what content should be displayed to users who do not have a set language or do not conform to any of the options. In case, this tag is structured as follows:

<Link rel = "alternate" href = "https://exemplo.com/portugues-brasil/" hreflang = "x-default" />

For ease of configuration, you can use the tool The hreflang Tags Generator Tool . In it, just include the URLs, languages and countries (optional) and generate the code. Remember to include the URL and default language to also have that tag.

In the case of WordPress, you can use a plugin like hreflang Tags Lite , which allows the configuration on each post.

Example of application

A page that has versions in Portuguese for Brazil, English and Spanish, would need to have the following code:

<Link rel = "alternate" href = "https://site.com.br/conteudo/" hreflang = "en-us" /> (Note: indicating the version in Portuguese of Brazil)

<Link rel = "alternate" href = "https://site.com.es/contenido/" hreflang = "es" /> (Note: indicating the Spanish version)

<Link rel = "alternate" href = "https://site.com/content/" hreflang = "en" /> (Note: indicating the English version).

<Link rel = "alternate" href = "https://site.com/content/" hreflang = "x-default" /> (Note: indicating that if the user has not given language / region, this is the page to be submitted)

Important: all the pages that are involved in the code (in the example, the versions in Portuguese, English and Spanish) should have that inserted code within the <head> to the tag is applied correctly (this is one of the most common mistakes).


How to apply the tag hreflang using sitemap

Studying the best ways of implementing the hreflang tag, this post of Yoast  indicates to using a hreflang sitemap , as included in the code within the HTML of the pages can harm your load and be laborious thinking ahead.

For this, there is a tool called Hreflang Sitemap Tool  that lets you change a worksheet in a sitemap.

To make the sitemap using the tool, you can create a spreadsheet as in the example below:

spreadsheet-hreflang

Then download in CSV format and send it to the tool, you will receive a sitemap for each language and a general sitemap with all languages.

The sitemap of the code will look like this one:

code-sitemap-hreflang

If you have separate sites for languages, include the sitemap of your language on your server. For example, site.com.es/sitemap-es.xml

If you have a single site with multiple languages, separated by subdirectories, you can use only the file that meets all languages. Would look like: site.com/sitemap-geral.xml

Then just send the sitemaps in Google Search Console  and monitor the international segmentation of the site in the tool to confirm that everything is configured correctly. If you have set tags using one of the other methods, it is also important to monitor this in the Search Console.

segmentation-international

If your company is looking to expand to other languages or countries, the use of hreflang must be something prioritized  in strategy international SEO  and content production.

Their correct application should have a positive impact on the positioning of pages in other languages ​​and for other countries, generating more organic results.

For other important points about search engine optimization, download our free eBook: The Complete Guide to SEO .