How do I set up two languages and hreflang correctly?
Each language needs its own stable URL, and both versions must point at each other. Google only accepts an `hreflang` group when it is reciprocal: if A points to B but B does not point back, the whole declaration is ignored and the two languages start competing with each other.
The mistake is almost always the same, and it is silent: hreflang is there,
it looks right, and it does nothing. The reason is reciprocity.
Three rules are enough
Each version gets its own URL. /pricing and /en/pricing. Not
?lang=en: every parameter is another copy of the same page in the index.
Reciprocity. If the Lithuanian page declares its English version is
/en/pricing, the English page must declare the Lithuanian one is /kainos.
One mismatch is enough for the group to be dropped.
A pair only where one exists. A page without a translation should get no
hreflang at all. Declaring an alternate that does not exist is worse than
declaring none.
The most common mistake
Every page points at the home pages. This happens by itself when
hreflang is written into a shared template: /pricing declares that its
English version is /en rather than /en/pricing.
The result: no pair matches, the declaration is ignored, and Google decides which version to show. Often the wrong one.
x-default
x-default is for a visitor whose language you did not recognise. In practice
point it at the English version: someone whose language is not on your
list is probably not a local speaker.
What not to do
Do not switch language automatically by IP. Googlebot crawls almost entirely from US addresses, so a redirect means it never reaches the local version — and that version leaves the index. Google names this directly in its guidelines as something to avoid.
Offer instead: a bar at the top, once, with no redirect.
A free scan checks exactly this reciprocity: whether every pair matches from both sides.
Frequently asked
Does `hreflang` affect rankings?
Not directly. It helps Google show the right version to the right person, which affects clicks and behaviour indirectly.
Do I need `hreflang` if the languages are on different domains?
Yes. The rule is the same, only the URLs differ — reciprocity is required across domains too.
Is `sitemap.xml` enough?
It is: `hreflang` can be declared either in the HTML head or in the sitemap. What matters is not doing both with different values.
What about pages that exist in one language only?
Leave them without `hreflang`. That is normal and correct: some pages have a pair, some do not.
Check yours
A free scan shows which of the things described here your site already does, and which it does not.