I have recently added German language support to my website and now I want to show German version of my website in search results to German speaking visitors, and English version to all other visitors. I’ve added this link tags to my default page (https://example.com/
):
Desktop
<link rel="canonical" href="https://example.com/">
<link rel="alternate" media="only screen and (max-width:651px)" href="https://m.example.com/">
<link rel="alternate" href="https://example.com/" hreflang="x-default">
<link rel="alternate" href="https://example.com/?hl=de" hreflang="de">
Mobile
<link rel="canonical" href="https://example.com/">
<link rel="alternate" href="https://m.example.com/" hreflang="x-default">
<link rel="alternate" href="https://m.example.com/?hl=de" hreflang="de">
And this hreflang
tags for German version (https://example.com/?hl=de
):
Desktop
<link rel="canonical" href="https://example.com/">
<link rel="alternate" media="only screen and (max-width:651px)" href="https://m.example.com/?hl=de">
<link rel="alternate" href="https://example.com/" hreflang="x-default">
<link rel="alternate" href="https://example.com/?hl=de" hreflang="de">
Mobile
<link rel="canonical" href="https://example.com/">
<link rel="alternate" href="https://m.example.com/" hreflang="x-default">
<link rel="alternate" href="https://m.example.com/?hl=de" hreflang="de">
But I have a problem. When I search for Youtube on Google, it returns only German version of Youtube (https://www.youtube.com/?gl=DE&hl=de
). But when I search for my website, Google shows English version of my website as default and German version as a snippet. What is wrong with my code?
2
Answers
You implemented incorrect canonical URL.
You have different sites for desktop and mobile, and two languages english and german. They are serving different contents, you should update the canonical URL correspondingly.
Desktop
Mobile
Desktop German
Mobile German
According to the Google recommendations Duplicate content:
According to the Google recommendations Separate URLs:
So you need to remove from your Desktips this meta link
<link rel="canonical" href="https://example.com/">
.