murattunalı.

What is hreflang.

hreflang is the markup that declares a page’s language and region versions to search engines and determines which user is shown which version.

On a multilingual site the same content exists in several versions, and the search engine needs to know two things: are these translations of one another, and which user should see which one? hreflang answers exactly those two questions.

Without the declaration, two consequences follow. First, the versions can be mistaken for copies of each other, and the engine decides on its own which to index. Second, a user searching in German can be shown the Turkish page — the content exists but does not reach the right person.

Three rules

hreflang working depends on three rules, and all three are frequently violated. With one missing, the set counts as invalid.

  1. Reciprocity — if A declares B, B must declare A. A one-way declaration is invalid.
  2. Self-inclusion — every page must declare its own language too. This is often skipped and breaks the set.
  3. Absolute addresses — the links must be full addresses; relative paths are not accepted.

The second rule surprises most: a page declaring itself looks redundant, but it is part of the set’s definition. On a trilingual site every page must carry three links — itself included.

On this site every page carries four links: three languages and one default. The verification suite measures on every run that the set is complete and reciprocal.

Language code, region code

The value used in the declaration can be a language code or a language-region pair, and the two target different things.

A language code alone — the two-letter code for Turkish, say — targets EVERYONE who speaks that language: Turkish speakers in Türkiye, Germany and Cyprus see the same page. When no content differs by region, that is the right choice.

A language-region pair targets only that language’s speakers in a specific country. The distinction is meaningful only with genuinely differing content: different currency, different stock, different legal text. Declaring the same content twice under two region codes produces needless complexity.

  1. Language only — when no content differs by region. The most common and simplest choice.
  2. Language-region — when currency, stock or legal text genuinely differs.
  3. A region code cannot stand alone — a language code is always required.
  4. The code standards — ISO 639-1 for language, ISO 3166-1 for region. Invented codes do not work.

The last item is an error source: the country code for the United Kingdom, for instance, is easy to guess wrongly by intuition, and a wrong code invalidates the whole set. Codes are not guessed; they are taken from the list.

Where it is written

The declaration can live in one of three places, and the three are equivalent; the choice rests on practical grounds.

Writing it into the page’s head is the most common path and the easiest to audit. The links show when the page source is viewed, and an error is noticed immediately.

Writing it into the sitemap is the second path, preferred on large sites: the links gather in one file and no extra markup is added to each page. This site does BOTH — at page level every version’s own link set, and in the sitemap the same sets repeated. The set varies from page to page: a page existing in three languages carries four links, a Turkish-only one two.

The third path is the HTTP header, needed only for non-HTML resources — multilingual PDF documents, for instance.

The set must be complete, or not exist at all — a half-built setup is less useful than none.

How to audit it

hreflang is a layer that breaks silently: no error message, the page looks normal, and only the wrong language version starts appearing in search results. The setup therefore cannot be done once and left; it needs auditing and, preferably, binding to a test.

  1. Look at the page source — does the link count match the language count, itself included?
  2. Check the reciprocity — go from each page to the others and look for the return link.
  3. Any conflict with the canonical — does each language version give the canonical to itself?
  4. Are the codes standard — verified against the list, not guessed.
  5. Are the addresses absolute — relative paths are not accepted.
  6. Any error report in the search console — missing return links are listed there.

The last item is the cheapest audit: the search console gathers hreflang errors in a separate report and shows the reciprocity gaps directly. The report lags, but it is real — read from the site’s live state.

On this site the audit is additionally bound to code: the links are generated from a single source, so reciprocity is structurally guaranteed, and the verification suite measures the set’s completeness on every run. A hand-written set breaks at the first page addition.

What it does not do

Knowing what hreflang does not do prevents expecting the wrong thing of it. There are three common false expectations.

First: it does not raise rankings. hreflang is not a ranking signal but a matching signal. Set up correctly, it sends the existing visibility to the right user; it produces no new visibility.

Second: it does not solve duplicate content. For two similar pages in the same language, hreflang is no solution — that is the canonical declaration’s job. hreflang is for versions in different LANGUAGES.

Third: it does not redirect the user. It tells the search engine which version to show; it tells the browser nothing. When a user opens an address directly, hreflang plays no part.

The third point yields an important consequence: a correctly built hreflang set removes the need for automatic redirection. The search engine already shows the fitting version, and the user arriving directly has already opened the address they wanted.

A frame to close: hreflang is a multilingual site’s most technical yet most mechanical layer. Its rules are few, clear and undisputed — be reciprocal, include yourself, use absolute addresses. The difficulty is not in the rules but in keeping them consistent as the site grows. That is why not writing the links by hand, and binding them to a test, is this layer’s only real solution.

The set must be complete, or not at all — a half-built setup is less useful than none.

SOURCES