What is hreflang?

Hreflang is an annotation that tells search engines a page has versions in other languages or for other regions, and which URL is meant for which audience. It is written as <link rel="alternate" hreflang="..."> tags in the head, as HTTP headers, or in the XML sitemap. Google and Yandex support it. Bing has said it relies more on the content-language meta tag and other signals.

Hreflang does not make a page rank. It swaps the right version into results: a searcher in Mexico sees your Spanish page instead of the English one that would otherwise rank.

How it works

Each version lists every version, including itself. The values are an ISO 639-1 language code (en, es, de), optionally followed by an ISO 3166-1 region code (en-GB, es-MX). A region alone, such as hreflang="uk", is invalid (and uk is actually Ukrainian). The special value x-default marks the fallback page for users who match none of the listed versions, often a language selector or the main English page.

Annotations must be reciprocal. If the English page points to the Spanish page, the Spanish page must point back, or Google may ignore the pair. Every URL in the set should be the canonical, indexable version of that page.

Example

In the head of each of the three versions:

html
<link rel="alternate" hreflang="en-us" href="https://example.com/pour-over-guide/" />
<link rel="alternate" hreflang="en-gb" href="https://example.com/uk/pour-over-guide/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/guia-pour-over/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/pour-over-guide/" />

The same four lines appear, unchanged, on all three pages.

In WordPress

WordPress has no built-in multilingual support, so hreflang comes from the multilingual plugin that manages translations, such as WPML, Polylang, or TranslatePress, because only that plugin knows which posts are translations of each other. Multisite networks with one site per language use plugins built for that setup. Check that your SEO plugin and multilingual plugin do not both print hreflang tags.

Common mistakes

  • Missing return links between versions.
  • Wrong codes, such as en-UK (the region code is GB) or a region without a language.
  • Pointing hreflang at redirected, noindexed, or non-canonical URLs.
  • Canonicalizing all translations to one language, which tells Google the others are duplicates.
  • Using hreflang for identical content on the same language with no regional difference.

Common questions

Is hreflang a ranking factor?

No. It helps Google choose which version of a page to show, but it does not raise rankings on its own.

Do I need hreflang for a single-language site?

No. Hreflang only applies when you have the same content in more than one language or for more than one region.