If you have a website that serves content in different languages, then it's absolutely essential to understand and use the hreflang attribute.

"In many ways, hreflang is one of the more complex facets of SEO. Its use can feel relatively simple, but proper implementation, especially at scale, means it can get incredibly challenging, surprisingly quickly.
"That said, once you understand hreflang, and once you've mastered how to automate large parts of the hreflang generation and tagging process, the benefits far outweigh the potential complexities."
- Tom Brennan, SEO Account Director

For global brands with multi-regional presence and multi-lingual sites, hreflang tags are not only a means to optimise for Google SERPs but also to maximise and distribute authority across all domains and regions.

It’s incredibly powerful, yet there are many examples where sub-optimal implementation can impact negatively on Google SERPs. In this post, we will dive into what hreflang tag attributes are, why we use them, and the best practices for doing so.

What is Hreflang?

Let's start with the absolute basics.

SERPs - this stands for search engine result pages. For example, Google or Bing results pages for a search term

Multilingual Website - a multilingual website is any website that offers content in more than one language

Multi-Regional Website - a multi-regional website is one that explicitly targets users in different countries

    Some sites are both multi-regional and multilingual. For multilingual sites with identical content in multiple languages, Google recommends using different URLs for different language versions.

    Put simply, you can - and should - use hreflang tags (also known as rel="alternate" hreflang="x") to indicate to Google the language and geographical targeting of a web page.

    The benefit of using hreflang is that it enables Google to accurately serve the correct version of a web page to users searching in certain languages and from certain geographic locations.

    Where to Put hreflang Tags

    There are three ways to indicate multiple language/locale versions of a page to Google. But you should use only one method.

    1. HTML tags within HTML head

    2. HTTP headers

    3. XML sitemaps

    What Does the Hreflang Attribute Look Like?

    When using the hreflang attribute on each page, it should include a reference to itself in addition to all of its related pages (in other languages).

    For instance, if you have a website in French that also serves customers in Spain and Italy, the hreflang attributes you include (across all three pages) might look like the below:

    <link rel="alternate" href="http://example.com" hreflang="fr-fr" /><link rel="alternate" href="http://example.com/es/" hreflang="es-es" /><link rel="alternate" href="http://example.com/it/" hreflang="it-it" />

    11 Hreflang Attribute Best Practices

    1. Use only one method for hreflang implementation

    For instance, if you are implementing the XML sitemap method ensure there are not any ‘hreflang tags’ in HTML tags in the head.

    2. Hreflang structure for Sitemaps

    You should consider splitting up your large sitemap into smaller child sitemaps. We can also optionally create a sitemap index file (a file that points to a list of sitemaps).

      Here are a couple of points to consider when splitting your sitemap:

      • You do not need to implement hreflang for the parent sitemap index files
      • All formats limit a single sitemap to 50MB (uncompressed) and 50,000 URLs
      • Hreflang URLs are excluded from the total number of URLs limit
      • Implement hreflang only for child sitemaps that you want to include in hreflang 1:1 URL mapping
      • Examples of child sitemaps based on your site structure or content may include:
        • Product detail pages
        • Support product detail pages
        • Product list pages or category pages
        • Product group pages
        • Press releases
        • Events

      3. Cross-domain validation (1:1 URL mapping)

      You can omit hreflang attributes from some sections of the site or a page on a specific market. Google will still process the ones that point to each other.

        Here are some examples:

        • Sections you can omit hreflang from include events pages, press releases, product advisories, as these sections are unique to their market
        • You can omit certain language regions or markets for some pages if the alternate URL is not available on that specific market. For example, if one PDP page is available on UK and DE market and not on FR, then we only include hreflang for UK and DE and omit FR for that specific page.
        • You should always validate the alternative versions of each page on the other markets. Here is an example:

        Validate the alternative versions of each page on the other markets.

        • Category 1 page in the UK (en-gb):
        • Category 1 page in Ireland: (en-ie)
        • Category 1 page in Germany: (de-de)
        • Category 1 page in the US: (en-us)

        4. Hreflang attributes should only point from canonical URLs to canonical URLs

        Hreflang should not contain broken links or links to non-canonical URLs - trailing slash, www and non-www, HTTPs, query strings, URL parameters, etc...

        5. Hreflang tags should point to a page that is indexable with an HTTP status code of 200

        Do not point to no-index pages or redirected pages. You should also not be blocked by robots.txt.

        6. Use the correct country and language codes

          - Language-region (hreflang="en-gb”) is valid. I.e., hreflang="en-gb”, hreflang="en-us", hreflang="de-de", hreflang="de-at"

          - Language (hreflang="en”) is valid. I.e., hreflang="en”, hreflang="de", hreflang="es”.

          - Region alone (hreflang="gb”) is invalid. I.e., hreflang="gb”, hreflang="uk".

          The value of the hreflang identifies the language (in ISO 639-1 format) and optionally a region (in ISO 3166-1 Alpha 2 format).

          7. Include self-referential hreflang

          Page X should have a self-referential hreflang to itself (page X).

          8. Hreflang annotations should cross-reference each other

          If page X links to page Y, page Y must link back to page X.

            9. “x-default”

            The reserved value hreflang="x-default" is used when no other language/region matches the user's browser setting. “X-default” is recommended but optional.

            10. Use correct / hreflang compatible XML namespace

            <?xml version="1.0" encoding="UTF-8"?>
            <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">

            11. Naming conventions

            Have a consistent naming convention across all sitemaps.

            You should include [child sitemap name, market], [language-region] in the XML-sitemap file name. This will help to identify the sitemaps by file names.

            For the UK: [sitemap-products-uk-en-gb.xml], [sitemap-support-uk-en-gb.xml]

            Examples of XML Sitemaps with Hreflang

            These are sample XML sitemaps for two URLs within three markets (UK, DE, US).

            • The number of URLs should be expanded according to the 1:1 URL mapping
            • The number of markets should be expanded according to the scope of the project. Each market should have its own XML sitemap

            US XML Sitemap

            UK XML Sitemap

            DE XML Sitemap

            Final Thoughts

            Any business that has both multi-regional presence and multilingual sites needs to consider implementing hreflang to optimise SERPs.

            However, if not used correctly, hreflang could have a damaging effect on your sitemaps and, consequently, organic performance.

            When implementing this in your XML sitemap, be sure to follow our key tips and tricks, which will in turn maximise your visibility across your domains.

            You'll Also Love

            Google Helpful Content Update: What You Need to Know | Patricia Pelegri Calderín, SEO Content Manager

            What is Google E-A-T? Why It’s Important for SEO | Kiera Lavington, SEO Account Director

            Semantic Search: What It Is and Why It Matters | Nick Livermore, Senior Marketing Manager

            What is Technical SEO? A Beginner's Guide | Telis Nikolaou, Technical SEO Specialist

            Top 5 Enterprise SEO Trends to Watch in 2022 | Robbie Reddy, Content Director