The HTML hreflang attribute (also called rel=”alternate” hreflang=”x”) tells Google which language is being used on a specific page so that the search engine can deliver that result to users searching in that language.
The hreflang attribute is used to create a better user experience for visitors searching in a specific language and country. By using it, we help Google to serve the specific page in the most appropriate language and country.
For SEOs, the hreflang tag ensures that the search result is provided in the native or preferred language and not in a different one.
Google allows up to three different methods to implement the hreflang tag. It is very important that we choose only one:
Here you will find an extensive article from Google’s engineers with detailed instructions on the three methods of implementation: Localized versions of your pages.
The hreflang attribute specifies the language of the document in the link:
Hreflang tags are easy to understand if we break them into three simple parts:
The ISO 639-1 format is used by Google to encode language on a web page, although it can be used in combination with the ISO 3166-1 format to specify specific regions.
If you have doubts about how to generate the hreflang code, we recommend you use an automatic generator like this one:
You can also check if the code of your pages is well constructed by using this Google Chrome extension or by using this hreflang tag validation tool:
The only drawback is that you have to go URL by URL checking that it is well implemented.
If your web page offers content in multiple languages or simply allows users to select the desired language, you can use the “x-default” value to indicate that the page is not targeted specifically for a particular language.
This can be done using the following HTML tag:
There are some technical errors that can trip some webmasters up if they are not careful.
When implementing the hreflang be sure to:
Not following the above steps can derail your international SEO efforts.
So take them very seriously.
The hreflang tags are a very effective tool to tell Google which language versions to serve depending on the location the search is coming from. Understanding and implementing them in the right way is essential to ensure that all SEO efforts of a multi-language project are put to good use.
Important: hreflang tags are a signal to search engines, but they are not directive, so Google may not use them if it deems them inaccurate. As an SEO, you need to make sure that you are sending the right signals and helping Google understand your site when indexing and ranking your pages.
Tools and recommended readings:
HTML hreflang tags on a web page are essential for Google to better understand our multi-language projects. If your web project uses different languages, learning how to implement them on your website is essential to ensure a good international SEO.
The easiest way to ensure that hreflang tags are well implemented is to use an automated tool. In our article, you will find several tools that can serve you in this purpose.