Skip to content

Hreflang

Hreflang is an HTML attribute that tells search engines which language and region a page is for, and which other pages are its translations, so searchers see the version in their language.

How it works

Each version of a page lists all its alternates with link tags such as <link rel="alternate" hreflang="es" href="https://example.com/es/">, including itself. An x-default entry names the version to show when no language matches. The same can be done in an XML sitemap or HTTP headers.

Common mistakes

Missing return links: if the English page lists the Spanish one, the Spanish page must list the English one too, or search engines may ignore the pair. Wrong codes, such as "uk" for the United Kingdom (it means Ukrainian; the region code is "gb"). Pointing hreflang at redirected or noindexed URLs.

When you need it

Only when you have the same content in several languages or for several regions. A single-language site does not need hreflang.

If you translate only some pages, add hreflang only to those pages and their translations. Untranslated pages need nothing, and an hreflang entry should never point to a page in a different language than it claims.

Hreflang and canonical tags

Each language version should have a canonical tag pointing to itself, not to the original language. Pointing every translation's canonical at the English page tells search engines the translations are duplicates, and they may ignore them along with their hreflang tags.

Example

A tool translated into Spanish and Portuguese adds hreflang tags for en, es, pt and x-default on all three versions, each listing the others.

Questions people ask

Is hreflang a ranking factor?
It does not raise rankings by itself. It helps search engines show the right language version to each searcher.
Do I need hreflang for a site in one language?
No. Hreflang only matters when the same content exists in several languages or for several regions.

Launch your startup on Aback Launch

Get a launch page that search engines and AI assistants can read, a place in the weekly launch list, and a review by a real person. Free to join.