Using alternative links

If your site has pages in different languages or is intended for different regions, you can send information about this to the Yandex robot. This information will help the robot determine which version of the page should be shown to a particular user in the search results.

Use alternative links if:

  • The page versions differ only in the template language. For example, this method is suitable for a blog (a site with user content). The post text isn't translated, while the navigation elements, the header and the footer can be displayed in different languages.

  • The page versions are in the same language but they differ in small details. For example, slightly different English texts can be addressed to users in the United States, Ireland and Australia.

  • Each page version is a complete and accurate translation of the page in the main site language.
  • The language of site pages is determined by the user settings (the Accept-Language header, IP) or a language selector on the page. In this case, use the hreflang="x-default" attribute.
  1. Localized pages markup
  2. Pages with automatic language detection

Localized pages markup

Each page version must contain information about all versions. To do this, add the link element in the head head element, in the following format:
<link rel="alternate" hreflang="lang_code" href="url" />

Use ISO codes to specify the language and region:

Page versions can be located on different subdomains and domains. For example, a page on the ru.example.ru site is duplicated in English (en.example.ru) for Americans and in Turkish (example.com.tr) for Turks. Each of the pages should contain three link elements with localization attributes:

<head>
    <title>Page title</title>
    <link rel="alternate" hreflang="ru" href="http://ru.example.com/" />
    <link rel="alternate" hreflang="en-us" href="http://en.example.com/" />
    <link rel="alternate" hreflang="tr-tr" href="http://example.com.tr/" />
</head>
  • ru: A page in Russian.

  • en-us: A page in English for users in the USA.

  • tr-tr: A page in Turkish for users in Turkey.

The site structure doesn't affect the processing of the hreflang attribute. Page versions can be located in different directories.

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

Pages with automatic language detection

If there are site pages where the language is determined by the user settings (Accept-Language, IP), or pages featuring a language selector, specify them along with other localized documents. Let's assume that the home page example.ru from the example above changes the language depending on the user IP address. You should indicate it by setting the hreflang attribute to x-default.

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

If pages don't appear in the search results for a long time or were excluded from them, provide examples of such pages in the form.