Skip to content

hreflang

Entry #261 / 700 · Chapter 5 · 5.4 Logs, SSR vs CSR, migrations and i18n · Read in Chinese →
In one sentence

A tag declaring the language and region a page targets, together with its counterparts in other languages.

Analogy Mental model

The back cover listing the English, Chinese and French editions. Wherever you buy it, you can find the one you read.

In practice What you actually do

In the head, one alternate link per language including a self-reference, plus x-default for the unmatched case. The set must be complete and reciprocal, or the engine discards the annotations rather than guessing.

Where people get burned Pitfalls

One-way declarations are the most common error: A points at B, B does not point back, and the whole cluster is ignored. Generate the tags from the same data that generates the language switcher.

This entry was written in English from the Chinese original, not machine-translated. Read the Chinese version →