hreflang tag and SEO international

The implementation of the hreflang tag can help us improve the visibility of our website when it is published in several languages.
Image by Julián Sánchez
Julian Sanchez

Consultant · Millennials Consulting

hreflang tag

In this post we will try to help you better understand the hreflang tag and to improve your website when it is published in different languages. It is important to keep in mind that translations “on the fly” by using Google Translate plugins or api are not useful. All content must be translated and, if possible, by an expert in each language.

If you want a consultancy or advice SEO carried out by our team of experts, do not hesitate to contact Millennials Consulting.

What is the hreflang tag and what is it for?

The hreflang tag is a HTML attribute very useful in our webs when we work the content in several languages. Using this tag we are helping the crawling robots to locate the correct version of our website by language or region.

The hreflang tag tells search engines if a website is displayed in different languages, the location of the website and in which versions the content is served. The use of this tag is recommendable so much for the translation into several languages such as language variations, such as Spanish in South America. By applying this tag we help Google to better understand in which language our website is offered in order to show it to users according to their origin. If we have several versions of the same page, with this hreflang tag we are indicating to Google which of all the versions we want to show the user.

If we have a multilanguage website or ecommerce, this label is very convenient for improve positioning of our contents in different parts of the world.

Using this tag we can attract new audiences to our website.

  • Users from the same country who speak different languages
  • Users from different countries who speak other languages
  • Users from different countries speaking the same language

How to use the hreflang tag?

Enough with include in head section of our website the following link with the proper language code. We must place each of these labels in its corresponding language, as many as the languages ​​our website offers. Today, there are many plugins for website translation that offer this function automatically in their paid versions.

The correct format for hreflang tag implementation should be the following:

<link rel=”alternate” hreflang=”it-IT” href=”https://www.yourdomain.com/“/>

  • relay link=“alternate”: The link in this tag is an alternate version of this page.
  • hreflang=“x”: It is alternative because it is in another language and that language is x.
  • href=“https://mydomain.com/alternative-page”: The alternative page is at this address.

Hreflang gives search engines important information about your content, as it indicates language codes and country codes for each content. This code tells search engines which language and region the content is targeting. It is important to note that the attribute value must contain both the language and the country “is-ES”.

There are tag generators like this.

Relationship between hreflang tags

The relationship between hreflang tags means that it must reference itself and all other versions. When we talk about bidirectional relationship each tag must be paired with a tag in the alternate content.

For example, if the ES page connects to the EN page, then the EN page must connect back to the ES page.

Language and region codes

The value of the hreflang attribute indicates the language (in format ISO 639-1) and sometimes the region (in format ISO 3166-1 Alpha 2) of an alternate URL. If only one code is provided, Google considers it a language code. The language does not have to be related to the region. By example:

de: content in German, regardless of region

en-GB: English content aimed at British users

of is: content in German for users who are in Spain

SEE ALL THE CODES AT THE END OF THE POST

Golden Label x-default to show a specific version to users of languages ​​not indicated

La X-default variant creates a default version of a page that is not targeted to a specific language where users are prompted to select language. This is very useful for users who don't have a default language in your browser settings

For example, if we serve our website in ES and EN languages ​​and a user accesses from China, by default we can indicate that the website is served in English.

An optional value, but it's recommended to include it to control which version is shown to users of languages ​​you haven't specified. It is not necessary to specify a language code in the x-default value.

Example.

  • UK
  • USES
  • AUSTRALIA
  • BY DEFAULT / rest of users

What function does the hreflang tag have in SEO?

The main function of this tag is to improve the usability of the website as we make it easy for users to localize our content in their language or location. This can also help us with positioning, since if a website in one language has a good positioning, it can affect other language variations.

How does the hreflang tag help us in the SEO International?

First of all, the use of this label helps us to improve positioning SEO international We have already defined the correct version for each language and this is detected by crawlers such as Googlebot. In this way we help search engines to index the keywords in the correct language.

The implementation of the hreflang tag helps avoid duplicate content since we are indicating the different versions of our website.

When to use the hreflang tag?

Sometimes Google can detect the different language versions of a website but it is important to indicate it. Google our recommended indicate localized versions in Google Search Console in the following cases:

  • When the content is only in one language but there are regional variations with very similar content. For example, pages with content in Spanish aimed at Mexico, Spain or Colombia.
  • When web content is in a language and a translation of the template is made, from the navigation menu and web footer. This situation usually occurs on pages with user-generated content, such as forums.
  • The content is fully translated into several languages. For example, pages with a version in English and another in Spanish.
  • When our home page is created for all users to exception of visitors with a specific language. In this case the website is partially translated and only provides content to certain specific users in certain languages ​​or regions. All other users will be directed to the default home page.

Methods to indicate alternative pages

You can tell us that a page has versions in other languages ​​or targeted to certain regions in three different ways:

HTML

HTTP headers

Link: ; rel=”alternate”; hreflang=”lang_code_1″, ; rel=”alternate”; hreflang=”lang_code_1″, …

Sitemap

Specify the xhtml namespace like so:

xmlns:xhtml=”http://www.w3.org/1999/xhtml”

Create an item different for each URL.

Each element must include a child element indicating the URL of the page.

Each element must have a child element with all variants of the page, including that of the element itself. The order of these children It's not important, but we recommend that you always use the same one to make it easier for you to check for errors.

Example.

<urlset xmlns=»http://www.sitemaps.org/schemas/sitemap/0.9″

  xmlns:xhtml=”http://www.w3.org/1999/xhtml”>

 

    https://www.example.com/english/page.html</loc&gt;

    <xhtml:link

               rel=”alternate”

               hreflang=”de”

               href=”https://www.example.com/deutsch/page.html”/>

    <xhtml:link

               rel=”alternate”

               hreflang=”de-ch”

               href=”https://www.example.com/schweiz-deutsch/page.html”/>

    <xhtml:link

               rel=”alternate”

               hreflang=”en”

               href=”https://www.example.com/english/page.html”/>

 

Common errors with the hreflang tag

Missing reciprocal linksIf page X includes a link to page Y, then page Y must also contain a link to page X. If this condition is not met on all pages using hreflang tags, these tags may be ignored or misinterpreted. For example, if in https://de.example.com/index.html This link is included:

An hreflang link should also be included in https://en-gb.example.com/index.html that returns to the version of the content:

Wrong language codes: Make sure the language codes you use identify the language in ISO 639-1 format and, optionally, the region in ISO 3166-1 Alpha 2 format of alternate URLs. You cannot specify only the region.

test hreflang

you can use this tool to verify correct implementation of this tag.

https://app.hreflang.org/

Fonts

https://developers.google.com

Content

🚀

Ready to transform your company?

30 minutes with a Zoho Premium consultant PartnerNo cost, no obligation.

Response in less than 24 hours

Share article

Blog · Millennials Consulting

Latest articles from Blog

+ 200

Completed projects

90 days

Average go-live time

4x

Average ROI first year

6

Offices Spain & LATAM

We have designed this proposal
thinking about your business

We're ready when you are. No pressure, no commitment, just real results.

Contact

Tell us about your project. We'll get back to you in less than 24 hours.

Our team analyzes your situation and proposes the CRM more suitable for your company, without commitments.