A
A
Anton2020-12-24 16:52:00
Google
Anton, 2020-12-24 16:52:00

How to set the language version of the site in Google SERP?

I made an English version for the site.ru site and placed it in a separate subdomain en.site.ru
I don’t know how correct this is, but to determine which version of the site to show to the user, I wrote js:

If the language in the browser is set to something other than Russian, then switch the user to the English version

Later, a problem got out in Google search engine, in the issue it shows the url of the main domain, and the description of the pages (title and description) is taken from the English version . Although, in the code of the pages for each version, the text and meta are written in the language of the site. At the same time, it does not display a single page of the en site in the search engine.
Site templates are ru for Russian and en for English
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
<html lang="ru">

The redirect is done like this:
часть кода вырезана ...
if (( userLang  == "ru" ) || ( userLang  == "ru-ru" ) || ( userLang  == "ru-RU" )){   
console.log(userLang);
}else
{
document.cookie = "s_lang=yes; max-age=31536000;"
location="<?=$engversiya?>";  
};

Auto-switching works on the first visit to the site, if the user manually changes the version, then I write the version in cookies and the version that the user preferred will be opened next time.
How to solve this problem in issuance?
How to make sure that the English version is not shown in the search results in the Russian Google and vice versa?
Yandex does not have this problem, each version is indexed as it should.

PS: Technically, I understand - the Robot went to one url, it was transferred to another, and he took the content from it, probably like that. I don't know how to solve this.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question