What Is Hreflang?

Brody Hall
Feb 15, 2024
what is hreflang

Hand off the toughest tasks in SEO, PPC, and content without compromising quality

Explore Services
Quick navigation

Ever wondered how certain websites cater their content to users from different corners of the globe? Enter hreflang tags—nifty snippets of code built just for this very purpose.

To get you up to speed with everything hreflang tags, here, we

  1. answer the question “What is hreflang?”
  2. discover why these tags are so important,
  3. and explore three different methods for implementing hreflangs.

What Is Hreflang?

The hreflang attribute, a key player in the SEO game, is born from the blend of “Hypertext REFerence” and “LANGuage.” Its role? To tell search engines which language and geographical area a specific web page is targeting.

Source.

You can sometimes spot the workings of hreflang tags in a web page’s URL. For instance, Logitech’s homepage URL includes the extension “/en-us” indicating that the language used on this page is American English.

Think of hreflang tags as a website’s in-house tour guide. For international visitors, this “guide” doesn’t just welcome visitors with a basic “hello,” “kon’nichiwa,” or “bonjour”—it speaks fluently, ensuring your content reaches the right audience, at the right place, in the right language.

Learn more: SEO glossary 250+ terms explained.

Why Is Hreflang Important?

If your website operates on the international stage, hreflang tags play several key roles that shape a seamless user experience and promote SEO performance:

  • Improved user experience. Hreflang allows your website to cater to a multicultural, multilingual audience. How? Direct users to a version of your website that suits their linguistic and geographic preferences. This tailored experience enhances user satisfaction, decreases bounce rates, and increases time-on-page.
  • Combat duplicate content. Having different versions of your website for different languages, like subdomains, can sometimes confuse search engines, leading them to flag your content as duplicate. The use of hreflang can help you circumvent these potential issues by signaling to search engines that these pages serve different linguistic and regional audiences.
  • Boost in local search rankings. The use of hreflang tags also indicates which language and region a given page is targeting, giving your website the best chance of appearing in local search results. This is particularly beneficial to businesses operating in multiple regions and countries.
  • Shared SEO value. The hreflang attribute enables pages in a hreflang cluster to share ranking signals. If one page gets a backlink or social share, this SEO value is distributed across all pages in the cluster, potentially boosting their performance in search engine rankings.

Different Ways to Implement Hreflang

There are three primary methods for implementing hreflang tags on a webpage: HTML tags, HTTP headers, or XML sitemaps. Each approach has its advantages and considerations.

Using HTML

The HTML method is probably the simplest and quickest way to implement hreflang. In this method, appropriate hreflang tags are added to the head tag of the webpage.

For this example, let’s return to our three spoken languages mentioned earlier—English, Japanese, and French.

In this context, consider the case of a travel agency offering guided tours in these three languages. The agency has a page on its website describing a specific tour of Hawaii. The content of this page has been translated into each of the three languages to ensure that speakers of all languages can understand the tour’s details.

In this case, the hreflang tags for the web page might look like this:

<link hreflang=”en” rel=”alternate” href=”http://example.com/tours/hawaii-en” />

<link hreflang=”ja” rel=”alternate” href=”http://example.com/tours/hawaii-ja” />

<link hreflang=”fr” rel=”alternate” href=”http://example.com/tours/hawaii-fr” />

The first tag indicates that the English version of the page (URL ending in “hawaii-en”) should be displayed to users who prefer to browse in English. The second tag does the same for Japanese speakers, pointing to the page version with the URL ending in “hawaii-ja”. And the third tag directs French language speakers to the page ending in “hawaii-fr”.

With these hreflang tags in place, as you can probably imagine, a user in Japan who searches for “Hawaii tour” in Japan will see the Japanese version of the page, an English speaker will see the English version, and a French speaker will be presented with the French version.

Hreflang tags aren’t used for just language, though.

Each version of the tour’s page would also need to display pricing in the respective local currencies. For the Hawaiian tour, let’s say British Pound (GBP) for English speakers, Japanese Yen (JPY) for Japanese speakers, and Euro (EUR) for French speakers.

In this case, the hreflang tags for these pages might look like this:

<link hreflang=”en-gb” rel=”alternate” href=”http://example.com/tours/hawaii-en-gbp” />

<link hreflang=”ja-jp” rel=”alternate” href=”http://example.com/tours/hawaii-ja-jpy” />

<link hreflang=”fr-eur” rel=”alternate” href=”http://example.com/tours/hawaii-fr-eur” />

The first tag indicates that the version of the page with pricing in British Pounds (URL ending in “hawaii-en-gbp”) should be displayed to users who prefer to browse in English (from Great Britain specifically, as per the region code “gb”). The second tag does the same for Japanese speakers from Japan, pointing to the page version with pricing in Japanese Yen (URL ending in “hawaii-ja-jpy”). And the third tag directs French-speaking users in France to the page version with pricing in Euros (URL ending in “hawaii-fr-eur”).

Using HTTP Headers

HTTP headers can also be used to implement hreflang attributes for non-HTML files that don’t have an HTML head section like PDFs (this approach isn’t just limited to non-HTML files—it can also be used on web pages if you wish).

For instance, if you have a PDF guide on “Digital Marketing Trends” in English, Japanese, and French, the HTTP header might look something like this:

HTTP/1.1 200 OK

Content-Type: application/pdf

Link: <http://example.com/digital-marketing-trends-en.pdf>; rel=”alternate”; hreflang=”en-us”,

<http://example.com/digital-marketing-trends-ja.pdf>; rel=”alternate”; hreflang=”ja-ja”,

<http://example.com/digital-marketing-trends-fr.pdf>; rel=”alternate”; hreflang=”fr-fr”

Using XML Sitemaps

Hreflang attributes can also be added to your XML sitemap. This approach is often the most efficient, particularly for large websites with a large number of web pages tailored toward multiple different languages. Why? If you take the HTML route, you’ll need to edit every single web page’s source code each time you add a new iteration in a different language.

So, what does the XML sitemaps approach look like in practice?

Well, for example, for the “Digital Marketing Trends” blog post, your sitemap’s hreflang markup might look something like this:

<urlset xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″

    xmlns:xhtml=”http://www.w3.org/1999/xhtml”>

  <url>

    <loc>http://example.com/digital-marketing-trends-en</loc>

    <xhtml:link rel=”alternate” hreflang=”en-us” href=”http://example.com/digital-marketing-trends-en” />

    <xhtml:link rel=”alternate” hreflang=”ja-ja” href=”http://example.com/digital-marketing-trends-ja” />

    <xhtml:link rel=”alternate” hreflang=”fr-fr” href=”http://example.com/digital-marketing-trends-fr” />

  </url>

</urlset>

Despite its efficiency, this method is possibly the most technically challenging of all the three methods mentioned here as it requires careful handling to ensure the sitemap is correctly structured and up-to-date. But if you get it right, hreflang attributes via XML sitemaps can have a substantial impact on site speed and overall SEO performance.

Conclusion

While hreflang tags are a critical part of a comprehensive SEO strategy, they represent just one small snippet of SEO. A truly effective strategy encompasses a wide range of practices, from on-page optimization and link building to local SEO and content marketing.

This is where Loganix steps in. With our suite of SEO services, we’re equipped to help you navigate the complexities of SEO and bolster your digital presence.

 🚀 So, if you’re ready to explore new horizons with your SEO strategy and reach audiences beyond borders, get in touch with Loganix today. 🚀

Hand off the toughest tasks in SEO, PPC, and content without compromising quality

Explore Services

Written by Brody Hall on February 15, 2024

Content Marketer and Writer at Loganix. Deeply passionate about creating and curating content that truly resonates with our audience. Always striving to deliver powerful insights that both empower and educate. Flying the Loganix flag high from Down Under on the Sunshine Coast, Australia.