Hreflang

Hreflang

The hreflang attribute helps search engines display the correct language and country version of a website to users.

What is the hreflang attribute?

The hreflang attribute is an HTML tag that tells search engines which language and region a page is intended for. It is integrated into the <head> section of a webpage and is particularly relevant for websites available in multiple languages or for different countries. Google uses this information to automatically display the appropriate language version to users in search results.

Why is hreflang important for SEO?

Anyone running a website in multiple languages faces a problem without hreflang: search engines may interpret the different language versions as duplicate content, which can negatively impact the ranking of all versions. The hreflang attribute solves this problem by clearly marking the versions as translations of each other rather than copies.

Additionally, it ensures that a user from Austria sees the Austrian version in search results, while a user from Germany receives the German version, even if both pages are in German.

How is hreflang implemented?

The tags are placed as <link> elements in the <head> of the page. The rule is: each language version must reference all other versions, including itself. Here’s an example for a multilingual website:

<link rel="alternate" hreflang="de" href="https://www.domain.de/" />
<link rel="alternate" hreflang="de-AT" href="https://www.domain.at/" />
<link rel="alternate" hreflang="de-CH" href="https://www.domain.ch/" />
<link rel="alternate" hreflang="en" href="https://www.domain.com/" />
<link rel="alternate" hreflang="fr" href="https://www.domain.fr/" />
<link rel="alternate" hreflang="x-default" href="https://www.domain.de/" />

The value x-default defines the fallback version, which is displayed when no other language version matches the user’s origin or language settings.

Using the correct language codes

Standardised codes are used for hreflang:

  • Language: Two-letter code according to ISO 639-1, for example de for German, en for English, fr for French.
  • Language and region combined: Language plus country code according to ISO 3166-1, for example de-AT for German in Austria or en-US for English in the USA.

The combination of language and region is useful when content differs between countries in terms of content or language, such as prices, products, or regional expressions.

Common mistakes in implementation

  • Missing reciprocal links: If page A links to page B, page B must also link back to page A. One-way links are ignored by Google.
  • Incorrect codes: Typos or non-existent codes prevent Google from processing the tags.
  • Forgetting x-default: Without this fallback, users with unsupported languages or regions may see the wrong version.
  • Only implemented on the homepage: hreflang must be present on every subpage, not just the homepage.

Checking the implementation

After setup, it’s worth verifying the hreflang tags. The Google Search Console shows errors in implementation under "International Targeting." Alternatively, specialised tools like Audisto.com, the hreflang.org Validator, or Screaming Frog SEO Spider can be used to check all tags on a larger website for consistency.

Conclusion

The hreflang attribute is relevant for all website operators offering content in more than one language or for more than one country. When used correctly, it prevents duplicate content issues and ensures that every visitor sees the version tailored to them in search results. The implementation is technically straightforward but requires attention to detail, especially regarding the reciprocal linking of all language versions.

Back to glossary