Webmaster
How Yandex indexes sites
A site on search results page

Localized page markup

Sites that provide versions of documents in different languages can tell Yandex about these versions by using the attribute hreflang. By using an attribute value, Yandex's robot can determine which version of the page is best to show to a specific user in search results.

The attribute hreflang is recommended in the following cases:

  • Page versions differ only in their template language. This is fine for sites with user-generated content, for example. The posts' text on forums or in blogs usually stays the same, but navigation elements and the page's header and footer can be displayed in different languages.

  • Page versions are in the same language, but differ in small details. For example, English texts that differ slightly can be directed to users from the USA, Ireland, and Australia.

  • Every page version is a full and precise translation of the page in the site's main language.

Localized Page Markup

Each page version should contain information about all alternative versions.

Page versions can be placed in different domains and subdomains. For example, the site's page ru.example.ru can be duplicated for Americans in English (en.example.ru) and for Turks in Turkish (example.com.tr). On each of these pages, there should be three corresponding elements <link> with localization attributes:

<link rel="alternate" hreflang="ru" href="http://ru.example.ru/" />
<link rel="alternate" hreflang="en-us" href="http://en.example.ru/" />
<link rel="alternate" hreflang="tr-tr" href="http://example.com.tr/" />

In the value of the hreflang attribute the page's language must be indicated and, if necessary, the language region should be set. The attribute in the given example can be interpreted in the following way:

  • "ru" — the page in Russian;

  • "en-us" — the page in English for users from the USA;

  • "tr-tr" — the page in Turkish for users from Turkey.

The site's structure does not influence the processing of attribute hreflang. Page versions can be placed in different catalogs:

<link rel="alternate" hreflang="ru" href="http://example.ru/o-kompanii/" />
<link rel="alternate" hreflang="en-us" href="http://example.ru/company/about/" />
<link rel="alternate" hreflang="tr-tr" href="http://example.ru/firma-hakkinda" />

The language and region should be indicated according to ISO standardized codes:

In addition to the element <link> a page's language and region can be designated by the HTTP-header Link, for example:

Link: <http://ru-ru.example.ru/>; rel="alternate"; hreflang="ru-ru"

Pages with auto-language detection

If the site has pages for which the user's settings determine the language (Accept-Language, IP), or that contain a language selector, then they must be indicated along with localized documents. Let's say that the main page of the site example.ru from the example above changes its language depending on the user's IP address. This should be reflected by assigning the value x-default to the attribute hreflang :

<link rel="alternate" hreflang="x-default" href="http://example.ru/" />
<link rel="alternate" hreflang="ru" href="http://example.ru/o-kompanii/" />
<link rel="alternate" hreflang="en-us" href="http://example.ru/company/about/" />
<link rel="alternate" hreflang="tr-tr" href="http://example.ru/firma-hakkinda" />
Rate this article
Thank you for your feedback!