I use this meta tags to make google crawler know that I have two languages for my site, as suggested here support.google.
<link rel="alternate" hreflang="x-default" href="http://www.example.com" />
<link rel="alternate" hreflang="de" href="http://www.example.com/de" />
<link rel="alternate" hreflang="en" href="http://www.example.com/en" />
This is the code that detects the language
const lang = (
getLangFromUrl(req.url) ||
getLangFromCookies(req.cookies) ||
getLangFromHeader(req.headers) ||
'de'
);
Now when a user visits the site, the language is detected first by query, if there is no lang in the query then the language is detected by cookie and ..., and if there is no sign of lang identifier then I render page with de language, so the content of www.example.com and www.example.com/de become the same as each other for google crawler, then google recognizes them as duplicated pages.
Can you please tell me how should it be correctly done to avoid the duplicate pages in search console?
from How to show a page in different languages?
No comments:
Post a Comment