Nodea — logo

Hreflang

Hreflang is an attribute used in a page's markup (or in the XML sitemap or HTTP headers) that tells search engines like Google which language, and optionally which region, a specific URL is meant for. Thanks to it, someone searching in a particular country is served the version that matches their language, and a multilingual site avoids duplicate content problems between nearly identical translations.

How hreflang works

The attribute value combines an ISO 639-1 language code with an optional ISO 3166-1 Alpha-2 country code — for example en, en-GB or de-CH. The most common implementation places link elements in the page head, and three rules are non-negotiable:

  • Self-referencing — every page must also point to itself.
  • Reciprocity — if page A points to B, then B must point back to A, or Google ignores the declaration.
  • x-default — an extra value for users whose language matches none of the declared versions.

Alternatively, the whole set of relationships can be declared in the XML sitemap, which is often more convenient for large sites where adding tags to every template is cumbersome.

Practical application

Hreflang is essential for stores and sites operating across multiple markets — for example when the same offer exists in Polish, English and German versions, or when two variants of one language coexist (en-US and en-GB). The most frequent mistakes are missing self-references, one-way declarations and wrong region codes (such as using 'uk' instead of 'gb'). Implementation should be combined with a correct canonical tag and regularly verified in Google Search Console, which reports detected hreflang inconsistencies.

Powiązane pojęcia

Najczęstsze pytania

Does hreflang improve rankings?

It doesn't boost rankings directly, but it improves relevance — users in a given country see the right language version, which lowers bounce rate and prevents cannibalization between variants. Well-implemented hreflang keeps a multilingual site's indexing clean and organized.

Does hreflang replace the canonical tag?

No, the two work in parallel. Canonical resolves duplicates within a single language version, while hreflang maps the relationships between different versions. Each page should have a self-referencing canonical plus a full set of hreflang entries pointing to its alternate versions.