We use cookies

This site uses cookies from cmlabs to deliver and enhance the quality of its services and to analyze traffic..

SEO Tools

New Chrome Extensions from cmlabs! Only for you

Check now
announcement icon
Where might you have seen our work?
Small places create combinations, but crosses that occur cannot provide many combinations. So be careful in making justifications, especially SEO.

Hreflang Tag: Know Its Structure and How to Implement It

Last updated: Sep 15, 2022

What is Hreflang?

Hreflang Tag is an HTML code that works to tell search engine robots the language and target geography of a page. The tag can help the page be displayed according to the language and geographic location of the target audience.

The role of this code is vital, especially for multi-language websites targeting an international audience. On such websites, one page will usually be available in two or more different languages.

The code will tell search engines that a content has several language variations. That way, search engines can provide a language version that suits the target audience.

The Importance of Hreflang Tag in SEO

The use of tag is very important for multi-language and regional websites because it can improve user experience and prevent duplicate content issues.

Improve User Experience

Audiences tend to be more comfortable looking for website content that is familiar and understandable. If your website uses Hreflang Tags and has several language versions, then search engines can provide content that is appropriate to the location or language of the audience.

This method not only reduces the bounce rate and increases time on page, but also affects traffic because websites with different language versions will increase the opportunity to bring in new audiences from various countries.

Prevent Duplicate Content Issues

Sometimes there are websites that only use one language but target several countries. For example, your website is in English and targets Australia and Singapore. This can potentially cause issues related to duplicate content.

For instance, you have two product pages that are similar in content and sell the same product. However, the first page is made for a Singapore audience at a special price, while the second one is made for an Australian customer at a different price.

By using the tag, search engines will understand that the two pages are intended for audiences from different geographic targets. Hence, the duplicate content issues can be avoided.

Hreflang Tag Structure

How is the Hreflang Tag code structure? The following are examples and explanations for each part of the code:

<link rel="alternate" hreflang="x" href="https://example.com/alternate-page" />

  • rel="alternate": tell search engines that a main page has an alternative version.
  • hreflang="x": language or region code used on alternate pages.
  • href=URL: location or URL of alternative page

You must follow the format specified in ISO 639-1 for language codes and ISO 3166-1 Alpha 2 for area codes. For instance, you should include the 'id' code format for Indonesian and the 'au' code format for the Australian region.

How to Add Hreflang Tags

To install the Hreflang Tag, there are three ways you can do it. The three ways are adding Tags in HTML code, HTTP Headers, and XML Sitemaps.

Adding Tags with HTML

The first way is to put the tag code and put it in the <head> of each page. This method is suitable for websites that only use a few language options. For example:

<link rel="alternate" hreflang="en" href="https://www.example.com" />


Implementing Hreflang in HTTP Headers

The next way is to add the tag code in the HTTP Header. This method can be implemented if your website has PDF content, DOC, or other non-HTML files. For example:

HTTP/1.1 200 OK
Content-Type: application/pdf
Link: <https://id.example.com/document.pdf>; rel="alternate"; hreflang="id". 


Putting Hreflang in the XML Sitemap

The final way is adding the code through the XML Sitemap. This method is suitable for websites with a large number of language versions. You can attach the tag code to the <loc> element by using the <xhtml:link> attribute. For example:



You can check the validity of your hreflang tags by using the hreflang checker from cmlabs. Try it now for free.

Our valued partner
These strategic alliances allow us to offer our clients a wider range of SEO innovative solutions and exceptional service. Learn More


WDYT, you like my article?

Latest Update
Last updated: Jul 12, 2024
Last updated: Jul 10, 2024
Last updated: Jul 09, 2024

Streamline your analysis with the SEO Tools installed directly in your browser. It's time to become a true SEO expert.

Free on all Chromium-based web browsers

Install it on your browser now? Explore Now cmlabs chrome extension pattern cmlabs chrome extension pattern

Need help?

Tell us your SEO needs, our marketing team will help you find the best solution

Here is the officially recognized list of our team members. Please caution against scam activities and irresponsible individuals who falsely claim affiliation with PT CMLABS INDONESIA DIGITAL (cmlabs). Read more
Marketing Teams



Ask Me
Marketing Teams



Ask Me
Marketing Teams


Business & Partnership

Ask Me
Marketing Teams


Business Development Global

Ask Me
Marketing Teams


Business Development ID

Ask Me
Marketing Teams



Ask Me
Marketing Teams


Product & Dev

Ask Me
Marketing Teams


Career & Internship

Ask Me

We regret to inform you that the Mobile Friendly Test is currently unavailable due to system maintenance until further notice.


Stay informed with our new tool, cmlabs Surge. Discover popular trends and events!


Your Opinion Matters! Share your feedback in our Plagiarism Checker Survey?


Discover your business trends effortlessly! The traffic projection calculator is the perfect tool to help you understand demand in your industry sector. Choose your sector and see its traffic projections now!


New Payment Option Media Buying Services at cmlabs with Xendit Payment Integration


There is no current notification..