问题原文
原帖链接 · phatskat · CC BY-SA 3.0
I'm working on a site where we have many different languages (about 24). When a content piece is authored in English, it is automatically copied to all language sites where it will be later translated to the proper language. Currently, we're using hreflang <link> elements in the head like so:
<link rel="alternate" hreflang="da" href="http://server/da/wiki/some-page/" />
<link rel="alternate" hreflang="de" href="http://server/de/wiki/some-page/" />
<link rel="alternate" hreflang="et" href="http://server/et/wiki/some-page/" />
<link rel="alternate" hreflang="en" href="http://server/en/wiki/some-page/" />
<link rel="alternate" hreflang="x-default" href="http://server/en/wiki/some-page/" />
<link rel="alternate" hreflang="es" href="http://server/es/wiki/some-page/" />
<link rel="alternate" hreflang="fr" href="http://server/fr/wiki/some-page/" />
<link rel="alternate" hreflang="is" href="http://server/is/wiki/some-page/" />
<link rel="alternate" hreflang="it" href="http://server/it/wiki/some-page/" />
<link rel="alternate" hreflang="lv" href="http://server/lv/wiki/some-page/" />
<link rel="alternate" hreflang="lt" href="http://server/lt/wiki/some-page/" />
<link rel="alternate" hreflang="hu" href="http://server/hu/wiki/some-page/" />
<link rel="alternate" hreflang="nl" href="http://server/nl/wiki/some-page/" />
<link rel="alternate" hreflang="no" href="http://server/no/wiki/some-page/" />
<link rel="alternate" hreflang="pl" href="http://server/pl/wiki/some-page/" />
<link rel="alternate" hreflang="fi" href="http://server/fi/wiki/some-page/" />
<link rel="alternate" hreflang="sv" href="http://server/sv/wiki/some-page/" />
<link rel="alternate" hreflang="tr" href="http://server/tr/wiki/some-page/" />
<link rel="alternate" hreflang="ru" href="http://server/ru/wiki/some-page/" />
<link rel="alternate" hreflang="ar" href="http://server/ar/wiki/some-page-2/" />
<link rel="alternate" hreflang="th" href="http://server/th/wiki/some-page/" />
<link rel="alternate" hreflang="ja" href="http://server/ja/wiki/some-page/" />
From my understanding, using x-default is preferred over canonical - is this correct? Also, do we need any additional tags for pages that aren't yet translated (such as noindex or nofollow)? A lot of the resources I've found have been contradictory to each other or not clear on what to do in the case of untranslated (duplicate) content.
已采纳解答
原帖链接 · unor · CC BY-SA 3.0
For HTML5:
A link with the
alternatelink type indicates that the linked document is an alternate representation of the linking document.A link with the
hreflangattribute indicates the language of the linked document.A link with
alternate+hreflangindicates that the linked document is a translation of the linking document (see my answer with a quote from the spec; and for reference, there’s one exception).
If you want to link to a page that contains the same content (in the same language, because it’s not translated yet), you
- may use
hreflang, but the value would have to be the content’s current language, not the language it may be translated into in the future (¹) - may use
alternatebecause the document is an alternate representation - may use
alternate+hreflang(because of the exception linked above: it’s not considered to be a translation if thelangattribute on thehtmlelement of the linking document has the same value as thehreflangattribute of the link)
In other words, the markup in your question is invalid, because a) the hreflang denotes the wrong language, and b) from this follows that you denote the linked document would be a translation although it isn’t (at least not yet).
In my opinion, the best solution would be not to link to untranslated pages. Such a link is typically not useful to your visitors: a German user lands on your English page, notes that you link to a German translation, follows that link, and ends up on a different page with the same content still being in English. Same idea with bots: you give them a wrong signal.
Instead, add the link as soon as the page is translated.
If that’s not possible, it can make sense to disallow indexing the untranslated pages by using a meta-robots element with the noindex value or the equivalent X-Robots-Tag header (examples), and/or to use the nofollow link type on links to untranslated pages (depending on which meaning gets used), especially if it might take a long time to translate the content.
(¹) For hreflang, the HTML5 spec only defines that it’s for giving "the language of the linked resource", so it’s not really clear which value to use for, let’s say, a German page (header, footer, navigation, sidebar) with English main content. If you think the value should be de because of the header/footer/etc. (instead of en because of the main content), then using the language tag for the language it will be translated into might be appropriate. In that case, the exception for alternate + hreflang is irrelevant, as you would actually link translations (although the main content isn’t translated).
FWIW, Google lists a similar case as first example for their hreflang guidelines:
You keep the main content in a single language and translate only the template, such as the navigation and footer. Pages that feature user-generated content, like forums, typically do this.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
