Skip to main content

What is hreflang?

Glossary image

Hreflang is an HTML attribute used to specify language and regional targeting for a web page. This is especially useful for websites that have content in multiple languages or that are aimed at different geographic regions. By implementing hreflang correctly, search engines like Google can understand which versions of a page should be shown to users based on their language and geographic preferences.

Why is hreflang important?

When a website has multiple versions of the same page in different languages, it can be difficult for search engines to determine which version is most relevant for the user. The hreflang attribute helps solve this problem by clearly identifying which page should be shown to which user. This improves the user experience by ensuring that visitors land on the page that is most relevant to them, linguistically and culturally.

How to implement hreflang

To implement hreflang correctly, you must add attributes in your page's HTML code or in the HTTP header. Here is a simple example of a hreflang implementation in HTML:

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

In this example, the three <link> tags indicate that there are alternate versions of the page in English, French, and Danish.

Remember these tips

  1. Consistency: Make sure all language pages correctly reference each other with the hreflang attribute.
  2. ISO codes: Use the correct ISO 639-1 language codes and ISO 3166-1 Alpha 2 country codes.
  3. Self-referencing hreflang: Each page should include a hreflang attribute that points to itself.

Implementing hreflang correctly can be challenging, but it is crucial for international SEO and for ensuring that your users get the best possible experience.

Have a question?

Get in touch if you'd like to learn more about this topic.

Contact Us