Technical SEO
What is hreflang.
In short
An attribute that tells Google a page has versions in other languages or for other countries, and which one to show to a given user. The foundation of multilingual SEO.
What it is for
If a site has Polish, English and German versions, hreflang tells Google they are the same content in different languages and helps it show the right one. A German user searching for your service should land on the German version, not the Polish one.
How to add it
Usually in the head of every version, for example <link rel="alternate" hreflang="pl" href="https://example.pl/uslugi/"> and <link rel="alternate" hreflang="en" href="https://example.pl/en/services/">. You can also specify a country, such as de-AT for Austria. Alternatively hreflang can go in the sitemap or HTTP headers.
x-default
The x-default value points to the page for users who match no specific version, such as a language selector or the main version.
Common mistakes
- Missing return links: if the Polish page points to the English one, the English page must point back. Otherwise Google may ignore the annotations.
- No self-reference in the set.
- Wrong codes, such as "en-UK" instead of "en-GB".
- Hreflang pointing to URLs that redirect, return errors or have a different canonical.
- Automatic IP-based redirects that stop Google from seeing all versions.