Hreflang attribute, the solution to main doubts and errors

Put us to the test
Put us to the test!
Analyze your site
Select the database

The hreflang attribute is often misinterpreted and misused on sites, so much so that it is considered one of the most frequent errors of SEO campaigns; yet, it is a fairly simple concept that allows us to eliminate ambiguity from a set of pages, especially in a common language, and to attribute them to a specific local area. Here are some tips and hints for using hreflang without errors, with the answer to some of the simplest and most frequently asked questions that can reduce the complexity and misinterpretation of the command.

Hreflang: what it is and why we make mistakes

In our support comes the guide written by Motoko Hunt on Search Engine Journal, which starts by briefly reminding you what hreflang is and what it means: that is, a simple method to indicate to search engines for which specific language and market is designed and optimized a page that presents the same content declined in several variants.

For the English language, for instance, “you can have a page for the United States and then having the same page for many other markets“.

Frequent questions on multi-language versions

Managing hreflang becomes complex only when the specifications are misinterpreted and / or when the web infrastructure is not evenly configured to make alternative mapping easy.

To clarify the issue, the expert then identified seven frequently asked questions about hreflang, which can lead to precisely these misinterpretations, providing useful answers and guidance to complete the process accurately.

  1. I have a site in English designed for the USA, UK and Ireland: can I use “Hreflang = en-us-gb-ie?
  2. I have one site for all EU countries and another for the whole Middle East: can I use “EU” and “ME” as country setting in hreflang?
  3. Can I combine the canonical tag and the hreflang tag in the same row?
  4. I use a CMS to automatically generate XML sitemap files (hreflang) and it includes URLs that do not exist: is it okay to keep them in the list? I see them displayed in reports on GSC errors: is it bad?
  5. Do I need to use hreflang to manage the same content that exists in different domains, each addressing different countries?
  6. Should I use the URL of a specific page or a home page as x-default?
  7. I have content in English and French on the same page: can I assign them to both languages in the hreflang tag?

Managing a site addressed to multiple Countries in the same language

The first question perhaps arises from an attempt of excessive creativity compared to the organization of the site; in reality, if we have only one set of EN pages, just use one attribute without specifying the countries, as in this string:

<link rel = “alternate” hreflang = “en” href = “https://www.example.com/en/page.html” />

If instead the site provides another set of EN pages for other English speaking countries such as Australia and Singapore and we want to set specific destination countries, it is necessary to create a separate line for each of them, even when the page URL is the same for all places. Such as:

<link rel = “alternate” hreflang = “en-ie” href = “https://www.example.com/en/page.html” />

<link rel = “alternate” hreflang = “en-gb” href = “https://www.example.com/en/page.html” />

<link rel = “alternate” hreflang = “en-us” href = “https://www.example.com/en/page.html” />

Best practices for different areas

Different is the attempt to specify the localization for geographic area: it is not possible to set attributes like

<link rel = “alternate” hreflang = “en-EU” href = “https://www.example.com/en/page.html” />

or

<link rel = “alternate” hreflang = “en-ME” href = “https://www.example.com/en/page.html” />

(European Community or Middle East respectively), since the Hreflang tag can only use the actual country and ISO language codes, and therefore is not expected to use regional codes such as EU, EMEA, APAC and ME.

Many sites have regional sites for Latin America (LatAm), the European Union (EU) or the Middle East (ME) that represent multiple countries and often languages in a region, but seek to associate one of the ISO country codes to represent the region.

A frequent error with this type of regional setting concerns the attempt to represent the Latin American site in Spanish using es-LA: actually, this command tells Google that the page is in Spanish language but served in Laos.

Canonical and hreflang, instructions for use

Another error is trying to combine in the same string of code i rel canonical and hreflang, as in the example

<link rel=”canonical, alternate” hreflang=”en-gb” href=”https://example.com/en-uk/page.html” /> .

It is mandatory to separate the canonical tag from the Hreflang tags, and then set as commands

<link rel = “canonical” “href =” https://example.com/en-uk/page.html “/>

<link rel = “alternate” hreflang = “en-gb” href = “https://www.example.com/en-uk/page.html” />

<link rel = “alternate” hreflang = “en-us” href = “https://www.example.com/en-us/page.html” />

Non-existent URLs in the XML sitemaps

Answering the fourth question, the situation described is yes a problem that may arise due to a CMS setting, “which allows you to automatically create a placeholder URL for each language or country of the site when a page is created on one of the sites”.

Sometimes, the URL is automatically generated by global navigation rules even if the page does not exist and “unfortunately there is no easy way to handle this problem”.

In short, non-existent page URLs should not be listed in the Hreflang XML sitemap files; the actual solution varies according to the individual CMS, but the intervention starts by examining the URL alias rules, the father-son rules or local page propagation rules that, in many cases, have not been set correctly.

It is possible that rules are overwritten by Javascript navigation rules or by IP detection/ redirection protocols; most systems have a fallback option on a global page when the page has not been located or published explicitly on the market.

Organizing pages on different domains

It is also not easy to manage multiple websites in a different language or country on separate domains, using hreflang on multiple domains (and subdomains). The correct procedure involves the use of “hreflang XML sitemaps that list all Urls for each of the unique domains, hoping that the URL paths are the same or at least similar, making it easy to map alternatives”.

To make the job even easier, Motoko Hunt suggests “to take advantage of the process of testing the sitemap between Google domains and use a dedicated site that manages the maps of the XML site for all domains in a central location, instead of having to create tickets to upload them to dozens of hundreds of unique domains”.

Guidance on the use of x-default

According to the expert, “there is still a lot of confusion about the use of x-default“, which is nothing more than a directive to use a specific page for any language or market that does not have a dedicated hreflang setting.

If we want to introduce ourselves where we do not have a local version, in many cases we can use the global version of the site or the English version, remembering that you can only designate one version as x-default.

If we set a home page as x-default for pages other than the homepage, we are asking Google to show the home page instead of any other page in the language-country that is not specified in Hreflang tags.

Moreover, we cannot dynamically change the setting to match the user’s local IP language: “it has been tried and no, it does not work”.

Content in different languages on the same page

Even more specific is the last doubt – contained in different languages on the same page – and the answer is simple: each page should only have content in one language, “but multiple languages on a single page occur frequently with user-generated content in a localized template”.

As for the choice of the hreflang version, Google is quite clear: you have to set the language region on the dominant language and / or on the language of the template.

Hreflang, a complex topic to simplify

Motoko Hunt’s article tried to demonstrate that managing the hreflang attribute itself is not difficult, but the website’s “interesting and sometimes challenging” infrastructures increase its complexity.

The final advice is to start small with a couple of languages or a subset of pages and try the settings, verifying their operation.

When we handle it properly we will appreciate its value, because hreflang is a brilliant business case to divert resources on for a large-scale implementation.

Call to action

Iscriviti alla newsletter

Try SEOZoom

7 days for FREE

Discover now all the SEOZoom features!
TOP