Discuss Your ProjectGet in Touch

What Is Hreflang?

Hreflang is an HTML attribute that tells search engines which language, and optionally which country, each version of a page is written for. When a website has the same page for British, Irish and French visitors, hreflang links those versions together, so Google can show each searcher the one that matches their language and location.

What hreflang tags look like

Take a garden room manufacturer that sells in the UK, Ireland and France. Its product page exists in three versions: English with prices in pounds, English with prices in euros and Irish delivery terms, and French. Each version carries the same block of lines in its head section:

<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/garden-rooms/" />
<link rel="alternate" hreflang="en-ie" href="https://example.com/ie/garden-rooms/" />
<link rel="alternate" hreflang="fr-fr" href="https://example.com/fr/abris-de-jardin/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/garden-rooms/" />

Each line names one version and its address. The first part of the code is the language, in ISO 639-1 format (en, fr, cy), and the optional second part is the country, in ISO 3166-1 Alpha 2 format (gb, ie, fr). The x-default line points to a fallback page for visitors whose language matches none of the versions, often a page where they choose their country.

Google’s guide to localised versions of a page sets three rules that catch most sites out:

  • Every version lists itself and all the others. The British page includes the line for the British page too.
  • The links must be reciprocal. If the British page points to the Irish one and the Irish page does not point back, Google ignores the tags.
  • Addresses must be complete, with https:// and the domain. A path such as /uk/garden-rooms/ is not accepted.

The same information can go in the head of each page, in an HTTP header (useful for PDFs) or in the XML sitemap. Google treats the three methods as equivalent and notes that using several at once gives no extra benefit and makes the set harder to maintain.

The UK trap: en-uk does not work

For British businesses, the most common mistake is writing “en-uk”. The country code for the United Kingdom in ISO 3166-1 is GB, and Google’s documentation lists UK, together with EU and UN, among reserved codes that have no effect in Search. The correct code for British English is en-gb.

Two related rules from the same page:

  • A country cannot be given on its own. The first code is always read as a language, so “be” means Belarusian, not Belgium.
  • Codes outside these standards are not supported, such as es-419 for Latin American Spanish.

When a website needs hreflang

  • The same content in different languages. An English and Welsh site (en-gb and cy-gb), or a manufacturer with English, French and German catalogues.
  • One language, several countries, with real differences. Prices in pounds and euros, different delivery terms, products that are only sold in one market, as in the garden room example.

A business that sells in one country, in one language, does not need hreflang. Neither does a site that has translated a single brochure page and has no matching versions of the rest.

Hreflang also depends on how the international versions are organised. Google’s guide to multi-regional and multilingual sites compares country domains (example.ie), subdomains (ie.example.com) and subfolders (example.com/ie/). Hreflang works with all three.

What hreflang does not do

  • It does not tell Google what language a page is in. Google states that it detects language from the visible content and does not use code-level information such as the HTML lang attribute for that. A page tagged fr-fr with English text is still an English page.
  • It does not translate or redirect anyone. Google advises against automatically redirecting visitors between language versions based on a guess about their language, and suggests linking the versions so people can switch themselves.
  • It does not merge duplicates. When the same text in the same language sits at several addresses, Google asks you to choose a preferred version with a canonical tag as well. Translated versions are not duplicates of each other, so each one normally carries a canonical tag pointing to itself.

Common hreflang errors

  • en-uk in place of en-gb, as above.
  • Return links missing because one version was added later and the older pages were never updated.
  • Hreflang pointing to addresses that redirect, return an error or are blocked from indexing. Every address in the set should be the live, indexable version of that page.
  • A theme and a plugin both outputting hreflang, with sets that disagree.
  • Language versions that exist in the tags but are only partly translated, so Google sees English text on the “French” page.

Errors like these often appear after a website migration or a redesign, when URLs change and the hreflang sets are not regenerated.

How hreflang is added on common platforms

On WordPress, multilingual plugins handle it: WPML, for example, inserts hreflang tags automatically and updates them as pages are added and translated. Shopify includes hreflang tags automatically for stores selling in several markets and languages, through the theme’s header. On a custom site, for example one built on Laravel, the tags are generated from the same database that stores the translations, so adding a language updates every page’s set at once.

Whatever the platform, check the output in the page source. Automatic tags are only as good as the URL and language settings behind them.

How we work with international sites

Hreflang problems rarely show on the page, so they usually surface in a technical SEO audit. For a small website the audit costs £210: you get a list of tasks with a recommendation for each one and a call where we go through them, and the fixes are a separate job for our development team. Our keyword research also covers other countries and languages, because people in Dublin and Lyon search with their own words.

FAQ

Most SEO specialists say “h-ref-lang”. The name joins two parts of HTML: href, the attribute that holds a link’s address, and lang, short for language.

No. The lang attribute on the page (for example lang=”en-GB”) declares the language of the content, mainly so that screen readers can use the correct pronunciation. Hreflang links one page to its versions in other languages or countries. A multilingual site should have both, and they should agree.

Yes. Google’s documentation states that alternate URLs do not need to be on the same domain, so a .co.uk site and a .ie site can be linked in one set. The reciprocal rule still applies: each domain has to point back to the other.

Start with the page source of a few pages in each language and look for a complete, matching set. A site crawler such as Screaming Frog reports missing return links and addresses that redirect or return errors across the whole site. Then, in Google Search Console, filter the Performance report by country and check that searchers in Ireland see the Irish pages and searchers in the UK see the British ones.

Running your website in more than one language or country? Tell us how the versions are set up and we will look at what Google is being told.
Book a call
See our technical SEO