HTML5:hreflang是否应始终指向直接翻译? [英] HTML5: should hreflang always point to a direct translation?

查看:115
本文介绍了HTML5:hreflang是否应始终指向直接翻译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将这种链接放在多语言网站的头部是一个好习惯:

This is a good practice to place this kind of links in head for multilanguage sites:

<head>
    <link rel="alternate" hreflang="en" href="/en">
</head>

但是,对于问题

But, according to an answer to the question Semantic markup for language switcher, language switcher should look something like:

<nav>
  <h1>Translations of this page</h1> <!-- could be omitted → usability question -->
  <ul>
    <li>English</li> <!-- could be omitted → usability question -->
    <li><a rel="alternate" href="/pl" hreflang="pl" lang="pl">Polski</a></li>
    <li><a rel="alternate" href="/de" hreflang="de" lang="de">Deutsch</a></li>
  </ul>
</nav>


据此,我有几个语义标记问题:

  1. SEO是否同时需要这两个规则?或者,如果我的网站上有语言切换器,是否不再需要head中的链接?

假设我在页面上:example.com/pl/kontakt. head(或nav)内的翻译链接应该指向:example.com/en/contact(直接翻译)还是仅example.com/en(英语主页)?

Let's say that I'm on the page: example.com/pl/kontakt. Should translation links inside head (or nav) point to: example.com/en/contact (direct translation), or only example.com/en (English mainpage)?

关于更具体的情况:example.com/pl/aktualnosci/id/101. "aktualnosci"表示新闻.如您所见,并非所有新闻都可以翻译成每种语言.有时仅基于参数很难预测出完美的翻译URL.因此,问题是:example.com/pl/artykul/id/101(或nav)的翻译应指向以下URL:example.com/pl/artykul/id/101,何时:

What about more specific situation: example.com/pl/aktualnosci/id/101. 'aktualnosci' means news. As you can see not all the newses can be translated into every language. And it is sometimes hard to predict the perfect translation URL, based on only parameters. So the question is: where should the translation link (or nav) point for this URL: example.com/pl/artykul/id/101, when:

  1. 我们不确定该资源是否已翻译?
  2. 我们不确定翻译网址吗?
  3. 100%的资源未翻译?


我希望我的问题清楚.但我再举一个例子:有人在example.com/en/news/2015/03/02/stackoverflow-rules页上,,此新闻未翻译成波兰语.放错了吗?


I hope my question is clear. But I will put one more example: Someone is on the page example.com/en/news/2015/03/02/stackoverflow-rules, and this news is not translated to Polish. Is it a mistake to put:

<link rel="alternate" hreflang="pl" href="/pl/aktualnosci">

作为翻译?当然,此页面不是翻译,而仅是所有翻译新闻的列表.

as a translation? Of course this page is not a translation, but only for example a list of all translated newses.

从我的角度来看,这是一个错误,因为这不是翻译,但从UX方面来说,这是个好习惯,因为它指向最近的翻译资源,并使用户的生活更轻松.

推荐答案

alternate + hreflang:linka

在语义上,使用哪一个没有区别.在这两种情况下,链接都链接到页面的翻译.

alternate+hreflang: link vs. a

Semantically it makes no difference which one to use. In both cases the link links to a translation of the page.

但是可以想象,消费者(例如搜索引擎)决定忽略a元素上的alternate + hreflang,例如,因为某些网站允许用户评论中使用此标记.用户很少可以编辑head,因此他们只能在head中的link元素上查找alternate + hreflang.

But it’s conceivable that a consumer (e.g., a search engine) decides to ignore alternate+hreflang on a elements, for example because some sites allow this markup in user comments. It’s rare that users could edit the head, so they might only look for alternate+hreflang on link elements in the head.

除非您有充分的理由不这样做,否则请简单地同时提供两者:

Unless you have strong reasons not to do this, simply provide both:

  • body(a元素)中的语言切换器,特别是对于您的人类用户
  • 为仅检查head(link元素)的漫游器翻译链接
  • a language switcher, especially for your human users, in the body (a elements)
  • translations links for bots that only check the head (link elements)

alternate + hreflang链接已定义为指向已翻译的文档 ,而不是网站.

An alternate+hreflang link is defined to point to a translated document, not a site.

如果未将/pl/artykul/id/101翻译成其他语言(或者您不确定它是否是其他语言,或者您不知道URL),则只需不要使用alternate + hreflang.

If /pl/artykul/id/101 is not translated into other languages (or you don’t know for sure that it is, or you don’t know the URL), simply don’t use alternate+hreflang.

是的,在这种情况下,链接到翻译后的 parent 页面是错误的:/pl/aktualnosci不是/en/news/2015/03/02/stackoverflow-rules的翻译.

And yes, it would be wrong to link to a translated parent page in this case: /pl/aktualnosci is not a translation of /en/news/2015/03/02/stackoverflow-rules.

当然,出于可用性的考虑,您仍然可以提供这样的链接,但是您不应为此链接使用alternate + hreflang标记.

Of course you could still provide such a link for usability reasons, but you should not use the alternate+hreflang markup for this link.

这篇关于HTML5:hreflang是否应始终指向直接翻译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆