gpt4 book ai didi

html - Google hreflang 语言困惑 : Do I have to add hreflang for the page ITSELF?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:29:46 26 4
gpt4 key购买 nike

关于 Google's hreflang documentation ,在 2 种语言的例子中,它说:

Imagine you have an English language page hosted at http://www.example.com/, with a Spanish alternative at http://es.example.com/. You can indicate to Google that the Spanish URL is the Spanish-language equivalent of the English page in one of three ways:

  • HTML link element in header. In the HTML <head> section of http://www.example.com/, add a link element pointing to the Spanish version of that webpage at http://es.example.com/, like this:

    <link rel="alternate" hreflang="es" href="http://es.example.com/" />

但在它的 3 种语言示例中,它说:

If you have multiple language versions of a URL, each language page must identify all language versions, including itself. For example, if your site provides content in French, English, and Spanish, the Spanish version must include a rel="alternate" hreflang="x" link for itself in addition to links to the French and English versions. Similarly, the English and French versions must each include the same references to the French, English, and Spanish versions.

以上是 3 种语言网站的示例。我的网站仅包含 2 种语言——默认/主要英语和泰语。我是否必须为页面本身添加标签? Google 的文档并没有明确说明这一点,并且在其双语站点示例中也没有提及。

例如,这是我在http://janwawa.com/en/contact.php中输入的内容

<!-- GOOGLE INTERNATIONAL LANGUAGE TARGETING -->
<link rel="alternate" hreflang="th" href="http://janwawa.com/th/contact.php">
<link rel="alternate" hreflang="x-default" href="http://janwawa.com/en/contact.php">
</head>

以上说法正确吗?或者我应该使用:

<!-- GOOGLE INTERNATIONAL LANGUAGE TARGETING -->
<link rel="alternate" hreflang="en" href="http://janwawa.com/en/contact.php">
<link rel="alternate" hreflang="th" href="http://janwawa.com/th/contact.php">
<link rel="alternate" hreflang="x-default" href="http://janwawa.com/en/contact.php">
</head>

最佳答案

如果你的目的是向他们展示中文用户的英文页面,你确实可以使用你的第二个例子:

<!-- GOOGLE INTERNATIONAL LANGUAGE TARGETING -->
<link rel="alternate" hreflang="en" href="http://janwawa.com/en/contact.php">
<link rel="alternate" hreflang="th" href="http://janwawa.com/th/contact.php">
<link rel="alternate" hreflang="x-default" href="http://janwawa.com/en/contact.php">

新的 x-default hreflang 属性值向 Google 的算法发出信号,表明该页面不针对任何特定语言或区域设置,并且在没有其他页面更适合时是默认页面 - Google

关于html - Google hreflang 语言困惑 : Do I have to add hreflang for the page ITSELF?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27598355/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com