hreflang

An attribute for specifying language and regional versions of a page. A key element of international SEO that prevents duplicate content.

In brief

hreflang is an attribute of the `link` tag (or HTTP header, or sitemap element) that tells search engines about alternative versions of a page in different languages or for different regions. Thanks to hreflang, Google shows the most appropriate version to the user.

What is hreflang

hreflang is used for multilingual and multi‑regional websites. It addresses duplicate content issues (same information in different languages) and helps Google choose the correct version for the user based on language and location.

Syntax and codes

HTML
<link rel="alternate" hreflang="ru" href="https://example.com/ru/" />
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="en-US" href="https://example.com/en-us/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

Codes: language – ISO 639-1 (ru, en, de). Language+region – ISO 639-1 + ISO 3166-1 (en-US, en-GB, pt-BR). x-default points to the fallback version when no language/region matches.

Implementation methods

  • HTML link in <head> ‑ the most common method for regular pages.
  • HTTP headers – for non‑HTML files (PDF, images, etc.).
  • Sitemap – convenient for large sites where adding annotations to each page manually is heavy.

Example in sitemap.xml:

XML
<url>
  <loc>https://example.com/ru/</loc>
  <xhtml:link rel="alternate" hreflang="en" href="https://example.com/en/" />
  <xhtml:link rel="alternate" hreflang="ru" href="https://example.com/ru/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>

Common errors when using hreflang

  • Missing self‑referencing (the page must point to itself)
  • No x-default
  • Incorrect language codes (e.g., rus instead of ru)
  • Relative URLs (absolute URLs with https:// required)
  • Asymmetric links (page A links to B, but B does not link back to A)
Test your hreflang using the 'International targeting' report in Google Search Console or third‑party testers (e.g., Aleyda Solis’s tool). Errors in hreflang may cause Google to ignore your annotations.

Common questions

Yes, Google highly recommends adding x-default to specify the version for users whose language or region is not covered by other annotations.
Yes. Each language version must have its own canonical pointing to itself. Do not set canonical to a different language version.
Use separate hreflang tags with regions. Google will show en-US to US users and en-GB to UK users if those pages are optimised for the respective regions.
Direct contacts

Discuss your project?

Share your goals and website context — I will suggest a practical next step.