Alternate/hreflang link element

Merche Martínez

Written by Merche Martínez

In 2011, Google introduced the hreflang link element to indicate alternative pages with similar content in different languages and/or markets. In 2013, the x-default attribute value was introduced, used when the version does not match any specified language or region.

Would you prefer to watch the video of this definition? We leave it here:

When to use hreflang

Google recommends using alternative pages in the following cases:

  • If the main content is not translated for the same page in different versions, it is considered duplicate content even if the common header and footer content is translated. In this case, it is recommended to define the alternate page for each version using alternate/hreflang.
  • Content for different versions of the same language. For example, Spanish pages for Spain and Mexico.
  • Equivalent pages in different versions and languages.

Whenever there is a multi-language website, we recommend using the hreflang link tag to indicate the equivalent pages of each version.

How to use

The hreflang link element supports the language codes defined in the specification ISO 639-1 and the region codes defined in the ISO 3166-1 alpha-2 specification. You can define the content for a language without depending on a region, for a language in a specific region or a default version. You cannot use the hreflang link element to specify only one region.

Here are some examples:

  • hreflang=”es”: content in Spanish, without identifying a specific region.
  • hreflang=”es-ES”: Spanish content aimed at users in Spain.
  • hreflang=”es-MX”: Spanish-language content targeted to users in Mexico.
  • hreflang=”x-default”: defines a default version for users whose browser settings do not match any specified language or region. The use of this attribute is not mandatory.

In languages such as Chinese, which has variations in its alphabet, it can be specified using the code ISO 15924.

  • hreflang=”zh-Hant”: content in traditional Chinese.
  • hreflang=”zh-Hans”: content in simplified Chinese.
  • hreflang=”zh-Hant-TW”: content in traditional Chinese for Taiwanese users.
  • hreflang=”zh-Hans-TW”: simplified Chinese content for Taiwanese users.

Ways to specify the alternate/hreflang link element

There are different options to indicate alternative pages:

Define alternate/hreflang with HTML tags

Within the <head> of each page a <link> tag must be included to specify the URL corresponding to each version, including that of the page itself. The format would be <link rel=”alternate” hreflang=”language_code/language_code/region_code” href=”url_page”>.

Define alternate/hreflang tags with HTTP headers

This option is recommended for non-HTML files, such as PDF files.

The format would be: Link: <url>; rel=”alternate”; hreflang=”language_code/language_code/region_code”, <url_version2>; rel=”alternate”; hreflang=”language_code/language_code/region_code”, …

Define alternate/hreflang tags with sitemap

In the sitemap file you can define the different equivalent versions for each language/region.

Inside the tag <url> you must include: <xhtml:link rel=”alternate” hreflang=”language_code/language_code/region_code” href=”url_page” /> for each version.

References

https://developers.google.com/search/docs/specialty/international/localized-versions?hl=en

  •  | 
  • Last modified on
Merche Martínez
Merche Martínez
Former SEO consultant at Human Level. Graduated in Computer Engineering with several specialization courses oriented to usability, layout and database optimization. Specialist in national and international SEO. She is also certified in Google AdWords.

What do you think? Leave a comment

Just in case, your email will not be shown ;)

Related Posts

en