If you have an international audience and get traffic from different countries, you will definitely want to translate your website’s content into different languages. It may help your audience but may it not be good for search engines. 

Simply publishing the translated versions of your website’s content on various URLs would not help Google to understand the relationship between the URLs and how your site is set up.  This is suboptimal and they can lead to your pages not ranking as well as they could do. 

What is hreflang and what does it do for SEO?

Hreflang is an HTML tag that specifies the language and relevant geographic region for a page. It tells the search engines where to find the content in different languages. 

Each hreflang tag tells bots reading the page where to find the appropriate content for users that don’t speak the first page’s language. Google takes following steps when someone browses for any site:

  • Based on its algorithm it decides the rank of the page
  • It finds the hreflang in the code of the page
  • It check the user’s IP address and language setting to know the users location
  • It displays the most relevant URL in the SERP and sends the user to that URL

When should hreflang tag be used for SEO?

  • When you translate only the page template into alternative language, not the main content of the page. For instance, you can use this tag when you want to define a page that features user-generated content like forums and message boards. 
  • When you have pages in the same language using regional variations. For instance, you have separate English versions of a page for US, Canada, The UK and Ireland.
  • When you have fully translated your website content into different languages. For example SEMrush website has its content in 9 languages. Following is the example of code:-

<link rel=”alternate” href=”https://websitetoon.com/” hreflang=”en”/>

<link rel=”alternate” href=”https://websitetoon.com/” hreflang=”us”/>

How to add SEO href tags?

If you have HTML page href tag goes into <head> section as given below:

<link rel=”alternate” href=”https://websitetoon.com/” hreflang=”en”/>

For non-HTML pages, like PDFs add the href annotation in the HTTP header:

Link: <https://websitetoon.com/>; rel=”alternate”; hreflang=”en”

In the examples above, the hreflang=”en” part of those tags tell Google the listed URL is the English version of the page. So it would show that URL to users who have their English set as their language in their browser and those in English-speaking countries. If they had hreflang=”es”, Google would display that URL for Spanish speakers.

When adding hreflang tags to your pages, you have to include a link to every version of the page, including a self-reference. So if you have a page in English, Spanish and French, each page would have all three tags:

<link rel=”alternate” hreflang=”en” href=”https://websitetoon.com/”>

<link rel=”alternate” hreflang=”es” href=”https://websitetoon.com/es”>

<link rel=”alternate” hreflang=”fr” href=”https://websitetoon.com/fr”>

Adding geographies to your hreflang tags can be done by adding a country code after the language code in the hreflang attribute. So if the website above is targeting different countries with each language, they would look like this:

<link rel=”alternate” hreflang=”en-us” href=”https://websitetoon.com/”>

<link rel=”alternate” hreflang=”es-mx” href=”https://websitetoon.com/es”>

<link rel=”alternate” hreflang=”fr-fr” href=”https://websitetoon.com/fr”>

How to add hreflang to an XML sitemap?

You can also add a hreflang tag to your XML sitemap. It can be a lengthy process because you need to add every language option to every URL in your sitemap. Below is an example:

<url>

<loc>https://websitetoon.com/</loc>

<xhtml :link rel=”alternate” hreflang=”en” href=”https://websitetoon.com/”>

<xhtml :link rel=”alternate” hreflang=”es” href=”https://websitetoon.com/es”>

</url>

Why should you add a hreflang tag to your XML sitemap?

Here are some reasons why you should add hreflang annotations to your XML sitemap.

  • Sitemaps are added to codes as they help the search engines find and crawl sites. So adding alternate URLs to your sitemap will help them get found more efficiently. 
  • It keeps extra code off the page, reducing the page size. It may not seem like much, but when even a second of load time costs sales, every little bit counts.
  • Keeping all your hreflang links in one place makes change management much easier. Updating a bunch of different pages is more difficult than changing one sitemap.

How does hreflang impact SEO?

Hreflang provides two main benefits in terms of SEO. First benefit of using hreflang is that it will help you to decrease the impact of duplicate content. It informs Google about the relationship between two pages and helps their spiders to identify the relationship between the two pages without seeing the two copies of the same content.

Second advantage of using a hreflang tag is it helps to provide the right content to the right audience. If you have an international business and your website is designed in different languages and uses different geographies, it’s obvious that you have put a lot of efforts, time and thought into designing your content accordingly and setting up marketing strategy for the ease of your audience. But if you do not use the hreflang tag in your code then all your hard work will get destroyed. Google will send the URL of english language to the user who only understands Spanish and or provide the Greek language content to australian user.