18 March, 2023

What Is the Hreflang Tag? Its Role in SEO

Quick summary: The Hreflang tag is an important piece of HTML code used to optimize how a page appears to users from different regions, countries or languages.

Hreflang tag is an important piece of HTML code used to optimize how a page appears to users from different regions, countries or languages. When Hreflang is set up correctly for SEO, you avoid duplicate content and make sure users are sent to the version that matches their language and location, which supports lasting SEO results. In this article, let's MONA Media look at the benefits, how to add Hreflang tags, and what to watch out for when using them.

What is the Hreflang tag?

The hreflang tag is an attribute used on a website to improve search results for a particular language. This attribute is also known as rel=”alternate” hreflang=”x”. Using the Hreflang tag is simple: write the Hreflang attribute code with the following syntax: link rel=”alternate” href=”http://example.com” hreflang=”en-us” />

The attribute rel="alternate" hreflang="x" is used by Google and Yandex. It helps search engines find alternate-language versions of web pages.

What is the Hreflang tag

When you create content for specific markets, the hreflang tag makes sure users see the right language version. For example, if your website has a Vietnamese home page and you add an English version, use Hreflang=”english”. Users visiting from the US or another English-speaking country will then automatically see the English content. This widens your reach, personalizes the experience and improves SEO Global.

This is why the language tag is seen as a strong ally for any SEO specialists that wants more visibility in many countries and languages. Currently Google and Yandex are the two major engines that understand and use Hreflang, while Bing mainly uses the language meta tag to handle multilingual versions.

Where should the Hreflang tag be placed?

Google currently supports Hreflang tags in three places: in the HTML head, in the HTTP header for non-HTML files, and in the XML sitemap. Each placement has its own advantages and helps optimize how your site appears to users worldwide.

Where to place Hreflang tags

Links in the HTML head

The most common way to create hreflang tags is to place them in the <head> section of the HTML page as links. The usual structure is:

rel="alternate" href="URL" hreflang="language-country code"

Where:

  • rel=”alternate” tells search engines that this page has an alternate version.
  • href = is the URL of the specified page.
  • hreflang= identifies the language and country the page is shown for.

The language code in Hreflang tags must follow the standard ISO 639-1 (for example vi for Vietnamese, en for English). If you only translate a page for the same country, you do not need to add a country code. If you want to target a specific country, use the ISO 3166-1 Alpha 2 code, for example au for Australia and sg for Singapore. When creating the Hreflang tag, also make sure the language code comes first and the country code second, such as es-us, en-au, zh-sg.

*Note: The <head> and <header> tags serve different purposes. The <head> tag contains technical information that is not displayed directly on the website, including the hreflang attribute. The <header> tag, on the other hand, sits in the page content and introduces the website to users, search bots or screen readers. 

In the HTTP header (non-HTML files such as PDF)

For special content such as PDF files or other non-HTML files, you need to declare Hreflang tags in the HTTP header. This is how search engines understand that the same document has several language versions, even though the content is not on a normal web page.

*Note: These techniques do not involve HTML tags in the page and are handled directly in the website's back end.

For example, if you have a PDF document available in English and Chinese, you can set it up in the HTTP header as follows:

Link: <http://en.example.com/document.pdf>; rel=”alternate”; hreflang=”en”,

      <http://zh.example.com/document.pdf>; rel=”alternate”; hreflang=”zh”

Placing Hreflang tags in the XML sitemap

Besides the two placements above, you can also implement Hreflang tags through the sitemap.xml file.

When should you use the Hreflang tag in SEO?

When to use Hreflang tags

Based on MONA's experience, you can use the Hreflang tag in these situations:

  • When your website has several language versions: For example, you can use hreflang="es-es" for Spanish content in Spain and hreflang="es-mx" for Spanish in Mexico. Users then reach the version that matches their language and region.
  • When your website has different content in the same language or region: For example, an English website serving the UK, US and Australia can use hreflang="en-gb", hreflang="en-us" and hreflang="en-au" to tell them apart. The hreflang language tag signals to search engines that these are different pieces of content, so they are not treated as duplicates.

Overall, the hreflang tag in SEO not only prevents duplicate content errors but also helps show the right version to each target audience. This lets your website personalize the experience, raise conversion rates and clearly improve SEO in a noticeable way.

How to use the Hreflang tag

How to use the Hreflang tag correctly

For the Hreflang tag to deliver its full value, implement it correctly in the following situations:

  • For websites serving multiple regions: When a website serves several markets, the hreflang tag improves the user experience, supports currency conversion and payment, and makes information and products easier to reach in each region.
  • Using differences in keywords and language: It is not only about language. It can also be used to Keyword SEO. Take football as an example. In the UK it is called "football", but in the US it is called "soccer". Adding the right hreflang tags helps Google understand the context and serve content that matches what people in the UK or the US are searching for. 
  • Cho multilingual websites: If your website has many translations, you can use the Hreflang language tag to make sure users are sent to the language version they know, which improves their experience and engagement.
  • Implementing through site structure: You can add hreflang tags by using subdirectories, subdomain or by buying a separate country-code domain (for example .uk for the UK, .us for the US, .de for Germany), so the website displays correctly for each market.

What role does the Hreflang tag play in SEO?

The role of the Hreflang tag in website SEO

The Hreflang tag matters a lot for SEO. It is one of the SEO website newest techniques you should not skip. Using the Hreflang attribute correctly brings many benefits, such as:

  • Increasing website traffic. It is a form of local targeting that returns the most accurate search results to users in the right geographic location or language. When searches and time on site go up, your keyword rankings improve effectively. This is one of the most effective ways of optimizing CTR today.
  • Hreflang tags help a website rank faster. More traffic makes your keyword rankings rise more easily. You can reach the top of SEO and SERP rankings, and your website reaches customers in the best possible way. Promoting your brand and growing revenue becomes much easier.
  • Most importantly, it improves user experience. Readers get search results that match their expectations. This is also a criterion Google uses to judge SEO optimization and to raise a website's ranking.
  • You can completely prevent the problem of duplicate content when you use the Hreflang attributes correctly.

How to add Hreflang to WordPress

Creating a Hreflang tag and adding it to WordPress is not hard. You can add it manually or with a plugin.

Using a plugin to add Hreflang to WordPress is quite easy. Some plugins, such as multi-language plugins, already include a feature for adding Hreflang tags to WordPress. You can also use the free Polylang plugin. The steps are:

  • Go to Hreflang. Select the "Dashboard”.
  • Select one or more "Content types" that need the hreflang tag.
  • Edit the post and the link for the language you want. You can copy the Hreflang tag to use across many posts and websites.
How to add Hreflang to WordPress

If you want to add the Hreflang attribute manually, follow these steps:

  • Create the Hreflang tag before adding it to WordPress.
  • Add the Hreflang tag before the </head> tag in your theme.

With most themes, go to "Appearance", then choose "Editor". Then find the header.php file and insert the Hreflang tag. Then just click "Update File" to save the changes.

If you use the Genesis Framework theme, go to "Genesis". Then choose "Theme Settings". Then choose "Header and Footer Scripts". Finally choose "Enter scripts or code you would like output to wp_head()". Click Save Changes and your Hreflang tag is added.

How to fix a website that has no Hreflang tag

If your website has no Hreflang tag, you can fix it with the steps below:

Step 1: Using Google Search Console to check your website. Specifically, go to Google Webmaster, then select International Targeting. If Google reports an error, your website currently has no such tag.

How to fix a missing Hreflang tag

Step 2: Use one of the SEO tools useful tools below to fix Hreflang tag errors:

  • The Hreflang tag generator from Aleyda Solis.
  • The Merkle SEO Hreflang tag testing tool.
  • The HREFLang checker and validator.

Common Hreflang mistakes to avoid

When implementing the Hreflang tag in SEO, many websites run into technical errors that stop Google from recognizing the right language or region version. To avoid reducing its effect, watch out for these mistakes:

  • Missing return links: If page 1 points to page 2 with Hreflang tags, page 2 must also link back to page 1 with the same tags. Skipping this reciprocal rule makes Google ignore the Hreflang structure or misread it.
  • Using the wrong language code format: When creating Hreflang tags, use the format ISO 639-1 because this is the standard code for classifying languages. Adding only a region code without a language code, or writing it in the wrong format, causes Hreflang tag errors. You can find the full list of language codes on Wikipedia.

In short, the Hreflang tag plays an essential role in improving SEO and helping your website reach the right target customers in each market. If you want to get the most from it but lack experience, do not hesitate to get help from experts. Mona Media offers professional full-scope SEO, complete website design together with an international-standard Hreflang optimization strategy. Contact us today to get a quote for full-service SEO and start building sustainable growth for your business.

Frequently asked questions about the Hreflang tag

What is the Hreflang tag?
The Hreflang tag is an important piece of HTML code used to optimize how a page appears to users from different regions, countries or languages.
About The MONA Group: Founded in 2016, with 60+ staff, MONA has delivered 14,000+ projects with an 85% client retention rate. MONA provides website design, full-scope SEO, custom software and AI automation solutions for businesses. Consultation hotline: 1900 636 648. Explore MONA SEO services and AI tools at work.
MONA has a podcast: listen instead of readingEpisodes on AI, automation & SEO for Vietnamese businesses
Nghe ngay
About the author

CEO & Founder · The MONA

Founder of The MONA, who built a services company of 200+ staff with 14,000+ projects delivered. Khánh Hùng shares how he thinks about building systems that run themselves, automating a business, and the real lessons from delivering projects at MONA.

Views 1,5K
Rate this article 4,6/5 · 15 ratings

Professional website
design services

Own a website with a beautiful, 100% exclusive design and a lifetime warranty, with the ability
to expand features flexibly as your business grows, starting today!

Contact Mona

    MONA có riêng một Người "Bạn Thân" cho bạn - Người Account sẽ đồng hành, hỗ trợ, hướng dẫn, đặt đồ ăn cho bạn mãi mãi, từ đây về sau!
    MONA will never sell your information or send you spam

    NHẬN TƯ VẤN SEO MIỄN PHÍ !

    Đội MONA tư vấn hệ thống quản lý giáo dục trực tuyến
    Hỏi đáp giáo dục 4.0
    Tạo cuộc hẹn miễn phí với MONA để giải đáp và tư vấn mọi thắc mắc về giải pháp số hoá ngành giáo dục
    Thời lượng cuộc hẹn
    45 Phút
    Ngày và giờ
    Thứ 2, ngày 25 tháng 12, 2023
    [9:30 - 10:15]

      Chọn ngày và giờ
      Khung giờ
      Back
      Hãy cho MONA biết bạn là ai
      0:00