我的hreflang标签有什么问题?

问题描述 投票:0回答:2

我最近在我的网站上添加了德语支持,现在我想在搜索结果中向德语访问者显示我的网站的德语版本,并向所有其他访问者显示英语版本。我已将此链接标记添加到我的默认页面(https://example.com/):

桌面

<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">

移动

<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">

这个hreflang标签为德语版(https://example.com/?hl=de):

桌面

<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">

移动

<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">

但我有一个问题。当我在Google上搜索Youtube时,它只返回德语版的Youtube(https://www.youtube.com/?gl=DE&hl=de)。但是当我搜索我的网站时,Google会将我网站的英文版本显示为默认版本,将德语版本显示为片段。我的代码出了什么问题?

html seo multilingual hreflang
2个回答
0
投票

你实现了错误的canonical URL

如果您有多个网址可访问的单个网页,或具有相似内容的不同网页(例如,同时包含移动版和桌面版的网页),则应明确告知Google哪个网址对该网页具有权威性(规范)。

您有不同的桌面和移动网站,以及两种语言的英语和德语。它们提供不同的内容,您应该相应地更新规范URL。

桌面

<link rel="canonical" href="https://example.com/">

移动

<link rel="canonical" href="https://m.example.com/">

桌面德语

<link rel="canonical" href="https://example.com/?hl=de">

移动德语

<link rel="canonical" href="https://m.example.com/?hl=de">

0
投票

根据Google recommendations Duplicate content

使用顶级域名:为了帮助我们提供最合适的文档版本,请尽可能使用顶级域名来处理特定国家/地区的内容。例如,我们更有可能知道http://www.example.de包含以德国为重点的内容,而不是http://www.example.com/dehttp://de.example.com

根据Google recommendations Separate URLs

在桌面页面(http://www.example.com/page-1)上,添加:<link rel="alternate" media="only screen and (max-width: 640px)" href="http://m.example.com/page-1">并在移动页面(http://m.example.com/page-1)上,所需的注释应为:<link rel="canonical" href="http://www.example.com/page-1">

所以你需要从你的提示中删除这个元链接<link rel="canonical" href="https://example.com/">

© www.soinside.com 2019 - 2024. All rights reserved.