What is your challenge?

Talk directly to a digital expert at  +49 (0)30 91684401

I want news!

Contact
Viele sehr ähnliche Schafe auf einer Wiese
SEO

Hreflang Tag – The must-have for international websites

Home Blog
Corinna Vorreiter 15/01/21

When should you use the Hreflang tag?
You have problems with duplicate content, because the contents of your German, Swiss and Austrian pages are often identical? Here the Hreflang tag helps. We explain what this tag can do, how to install it and what advantages the Hreflang tag brings with it.  


If you run a multilingual and/or multiregional website, you should use the Hreflang tag. It helps you in two ways:

  • It avoids duplicate content.
  • It shows Google which version belongs to which language and country.


You probably have the same content translated into different languages or even the same content for your German, Austrian and Swiss website versions. Here you need to be especially careful of duplicate content and be very specific about which version is relevant for which region.

What is a Hreflang Tag?

This tag distinguishes different versions of a given web page. The tag should be used on every relevant subpage. For example, if you have a product detail page that exists in three versions for Germany, Austria, and Switzerland, it’s worth tagging all three. This way you show Google which page is relevant in which region, and at best rank with the correct version (including correct currency and delivery time) in all three countries.

Even if your site is multilingual, this award is worth it, especially if your site has been translated one-to-one.

In our example (language German), the tag would look like this:

<link rel=”alternate” hreflang=”de-de”
href=”https://beispiel.com/de/produkt-1” />
<link rel=”alternate” hreflang=”de-at”
href=”https://beispiel.com/at/produkt-1” />
<link rel=”alternate” hreflang=”de-ch”
href=”https://beispiel.com/ch/produkt-1” />

The abbreviations in the Hreflang stand for the language and the region, in our example thus:

  • de-de: German content for users from Germany
  • de-at: German content for users from Austria
  • de-ch: German content for users from Switzerland


It is important that the hreflang tag must also be self-referencing. So on the page example.com/de/product-1 this URL must also be specified for users from Germany (de-de).

Hreflang vs Canonical

If the hreflang tag is to avoid duplicate content, why not work with canonicals?
If you still want to be in the index and rank with all three example pages, then the canonical solution unfortunately doesn’t work. With a canonical you show Google that a page is only a duplicate of another page. Therefore only the original will rank. So in our case it is rather suboptimal, because we still want to rank with the Swiss page in Switzerland, with the German page in Germany and with the Austrian page in Austria.

How do I create the Hreflang tag correctly?

There are several generators online. Of course, you can also create the tags yourself according to the example above and use a country code list for help. For this, there are Hreflang checks with which you can check your code.

Hreflang x-default
Of course, it would be difficult and unnecessary to cover all countries and languages of this world by hreflang tag. For all cases that are not covered, the x-default is responsible. In our example it would look like this:

<link rel=”alternate” hreflang=”x-default
href=”https://beispiel.com/de/produkt-1/” >

So here, all visitors who cannot be localized in Germany, Austria or Switzerland will be referred to the German page (de).

Where is the tag installed??

There are three ways to include the tag:

1. HTML link element in the header
In this variant, the tags are built into the header of each individual subpage as shown in the example above:

<link rel=”alternate” hreflang=”de-de”
href=”https://beispiel.com/de/produkt-1” />
<link rel=”alternate” hreflang=”de-at”
href=”https://beispiel.com/at/produkt-1” />
<link rel=”alternate” hreflang=”de-ch”
href=”https://beispiel.com/ch/produkt-1” />

2. Hreflang in xml sitemap

This variant is a good choice for websites that have a large number of regional versions of a web page. Putting the tags on each individual subpage would be a monumental task and a lot of code. Instead, an element is created in the sitemap for each URL with a loc tag and xhtml:links:

<?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”>

<url>
<loc>https://beispiel.com/de/produkt-1/</loc>
<xhtml:link rel=”alternate” hreflang=”de-ch”
href=”https://beispiel.com/ch/produkt-1″ />
<xhtml:link rel=”alternate” hreflang=”de-at”
href=”https://beispiel.com/at/produkt-1″ />
<xhtml:link rel=”alternate” hreflang=”de-de”
href=”https://beispiel.com/de/produkt-1″” />
</url>

<url>
<loc>https://beispiel.com/de/produkt-2/</loc>
<xhtml:link rel=”alternate” hreflang=”de-ch”
href=”https://beispiel.com/ch/produkt-2″ />
<xhtml:link rel=”alternate” hreflang=”de-at”
href=”https://beispiel.com/at/produkt-2″ />
<xhtml:link rel=”alternate” hreflang=”de-de”
href=”https://beispiel.com/de/produkt-2″” />
</url>

3. Hreflang in HTTP header

This form of markup is especially suitable for documents that are not in HTML form, for example PDFs:
Link: <https://beispiel.com/de/whitepaper.pdf/>; rel=”alternate”; hreflang=”de-de”
Link: <https://beispiel.com/ch/whitepape.pdf/>; rel=”alternate”; hreflang=”de-ch”
Link: <https://beispiel.com/at/whitepaper.pdf/>; rel=”alternate”; hreflang=”de-at”

Common mistakes

Ice cream on the floor
  • Self-Referral
    The self-referencing Hreflang tag is not used. So only the other language versions are indicated, but not the one that is currently being viewed.
    Example:
    On the page for users from Germany only the following Hreflang tags are specified:

    Zielseite: https://beispiel.com/de/produkt-1

    <link rel=”alternate” hreflang=”de-at”
    href=”https://beispiel.com/at/produkt-1” />
    <link rel=”alternate” hreflang=”de-ch”
    href=”https://beispiel.com/ch/produkt-1” />

    This forgets the self-referencing tag:

    <link rel=”alternate” hreflang=”de-de”
    href=”https://beispiel.com/de/produkt-1” />

    All tags must always be specified here!

  • Relative URLs
    Instead of the entire URL, only relative URLs are specified. Example:

    Target page:  https://beispiel.com/de/produkt-1

    <link rel=”alternate” hreflang=”de-at”
    href=”/at/produkt-1” />
    <link rel=”alternate” hreflang=”de-ch”
    href=”/ch/produkt-1” />
    <link rel=”alternate” hreflang=”de-de”
    href=”/de/produkt-1” />

    So here the “https://beispiel.com” is always missing at the beginning of each URL. The entire URL must always be specified.

  • Region and language are swapped
    It often happens that the ISO codes, i.e. the abbreviations for region and language, are accidentally swapped.

    Example:
    Instead of hreflang=”de-at” hreflang=”at-de” is specified. Here the rule is: first the language, then the region.

  • ISO codes are not used correctly
    Even the abbreviations are not always as one would think at first glance. For example, although Great Britain is usually translated as “United Kingdom”, the abbreviation for it is “GB” (i.e. Great Britain). It is therefore always advisable to look up the ISO codes.



Frequently asked questions

Is upper and lower cases of ISO codes relevant??
No, with the codes it doesn’t matter if you apply upper or lower case. So it doesn’t matter if the tag is hreflang=”de-AT” or hreflang=”de-at”.

Can I apply the Hreflang tag across different domains, i.e. “cross domain”?
Yes, this is possible without any problems. It doesn’t matter if you use top level domains (example.de), subdomains (example.com) or directories (example.com/en/), the principle is always the same. In concrete terms, a cross domain example would look like this:

Zielseite:  https://beispiel.de/produkt-1

<link rel=”alternate” hreflang=”en-gb”
href=”https://example.com/product-1”
<link rel=”alternate” hreflang=”fr-fr”
href=”https://example.fr/produit-1” />
<link rel=”alternate” hreflang=”de-de”
href=”https://beispiel.de/produkt-1” />

Does the order of the Hreflang tags matter?
Yes, the order does not matter and can be arranged as you like. So, for example, it doesn’t matter if you put the German version first, last or in the middle.

Do I need to include the hreflang tag on every subpage?
Yes, unfortunately it is not enough to include the hreflang tag on the home page. You have to include the tag on every relevant subpage, or at every URL in the sitemap. Relevant here usually means that this page exists again (possibly translated) somewhere else, for example our product 1, which exists on the German, Austrian and Swiss page with the same descriptions and texts.

Can I use the Hreflang tag if I have only one website??
No, in the case of a single website (i.e. a single language version), the hreflang tag makes no sense. This is explicitly meant to mark up international versions of the same content. If you produce duplicate content on a single website (for example, only https://example.com), you should choose a subpage that represents the “original” and thus ranks, and point the other pages with the duplicate content to it via the Canonical tag.



Conclusion: As soon as your website is available in more than one language version or in multiple regions, you should definitely use the hreflang tag to mark them correctly. If you don’t, you will most likely rank with the wrong website in the wrong region (e.g. with your German website in Austria). Also, Google will recognize duplicate content issues and will itself determine a canonical URL, i.e. an “original”, and consider the copies as duplicates. This should be avoided at all costs with the right markup through Hreflang tags.

Corinna Vorreiter
Corinna Vorreiter Digital Marketing Manager

Do you have questions about the blog entry or are you looking for professional support in this or any other area?
Then feel free to send us an e-mail via our contact form.

Contact

More Blog Posts

Generate backlinks – strategies for natural backlink building
Set anchor tags: Here’s how to do it right!