HTML:多语言元描述?
HTML: Multiple language meta descriptions?
如何为我的网站设置两种语言的元描述?
此代码google有效吗?
<meta name="description" lang="en" content="english blablabla" />
<meta name="description" lang="hu" content="hungary blablabla" />
从 Google 网站管理员中心博客中查看此 post:http://googlewebmastercentral.blogspot.com.es/2010/03/working-with-multilingual-websites.html
"Google 尝试确定每个页面的主要语言。如果您坚持每个页面只使用一种语言并避免 side-by-side 翻译。虽然 Google 可以将页面识别为使用多种语言,但我们建议对页面的所有元素使用相同的语言:headers、边栏、菜单等。
请记住,Google 会忽略所有 code-level 语言信息,从“lang”属性到文档类型定义 (DTD)。一些网页编辑程序会自动创建这些属性,因此在尝试确定网页的语言时它们不是很可靠。"
关于多语言网站的一些信息:
由于html“lang”属性不允许定义多种语言,并且用于指定语言的元属性已过时,根据 W3 的建议,最好在 HTTP header 中指定语言.
HTTP/1.1·200·OK
Date:·Sat,·23·Jul·2011·07:28:50·GMT
Server:·Apache/2
Content-Location:·qa-http-and-lang.en.php
Vary:·negotiate,accept-language,Accept-Encoding
TCN:·choice
P3P:·policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
Connection:·close
Transfer-Encoding:·chunked
Content-Type:·text/html; charset=utf-8
Content-Language:·en
与 http-equiv 属性设置为 Content-Language 的元元素一样,HTTP header 的值可以是 comma-separated 语言标签列表
参见:
https://www.rfc-editor.org/rfc/rfc2616#section-14.12
正如 RFC2616 所说:
Multiple languages MAY be listed for content that is intended for
multiple audiences. For example, a rendition of the "Treaty of
Waitangi," presented simultaneously in the original Maori and English
versions, would call for
Content-Language: mi, en
如果您转到 http://validator.w3.org/check 并尝试验证这一点:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Language" content="en,hu">
<meta charset="UTF-8">
</head>
<body>
<p>Test</p>
</body>
</html>
W3 验证器工具说:
Line 5, Column 52: Using the meta element to specify the document-wide default language is obsolete. Consider specifying the language on the root element instead.
然后,如果 html 标签上的 lang 属性不允许使用多种语言,我认为你最好的尝试是在 HTTP header
中指定它
lang
属性可以放在任何元素上,而不仅仅是根 html
元素或 meta name="description"
。所以你可以写 <html lang="en"><body>The Chinese translation of Stack Overflow is <span lang="zh-Hans">堆叠溢位</span></body></html>
并且最好把那些 lang
属性放进去因为它可以帮助视觉浏览器选择正确的字体和音频浏览器来帮助盲人选择正确的声音。
一些非 Google 搜索引擎仍然需要过时的 <meta http-equiv="content-language">
标记(特别是 Bing 并且据报道百度仍然需要这些)但我不知道它们的实现是否符合标准-足够兼容http-equiv="content-language"
中列出的两种或多种语言(试试看)。
至于搜索引擎是否会接受多种语言的 meta name="description"
的多个实例(具有适当的 lang
属性),这取决于搜索引擎。 Google 表示他们不喜欢并排翻译,这对于我们这些讨论外语的人来说是一种遗憾。
如何为我的网站设置两种语言的元描述?
此代码google有效吗?
<meta name="description" lang="en" content="english blablabla" />
<meta name="description" lang="hu" content="hungary blablabla" />
从 Google 网站管理员中心博客中查看此 post:http://googlewebmastercentral.blogspot.com.es/2010/03/working-with-multilingual-websites.html
"Google 尝试确定每个页面的主要语言。如果您坚持每个页面只使用一种语言并避免 side-by-side 翻译。虽然 Google 可以将页面识别为使用多种语言,但我们建议对页面的所有元素使用相同的语言:headers、边栏、菜单等。 请记住,Google 会忽略所有 code-level 语言信息,从“lang”属性到文档类型定义 (DTD)。一些网页编辑程序会自动创建这些属性,因此在尝试确定网页的语言时它们不是很可靠。"
关于多语言网站的一些信息:
由于html“lang”属性不允许定义多种语言,并且用于指定语言的元属性已过时,根据 W3 的建议,最好在 HTTP header 中指定语言.
HTTP/1.1·200·OK
Date:·Sat,·23·Jul·2011·07:28:50·GMT
Server:·Apache/2
Content-Location:·qa-http-and-lang.en.php
Vary:·negotiate,accept-language,Accept-Encoding
TCN:·choice
P3P:·policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
Connection:·close
Transfer-Encoding:·chunked
Content-Type:·text/html; charset=utf-8
Content-Language:·en
与 http-equiv 属性设置为 Content-Language 的元元素一样,HTTP header 的值可以是 comma-separated 语言标签列表
参见: https://www.rfc-editor.org/rfc/rfc2616#section-14.12
正如 RFC2616 所说:
Multiple languages MAY be listed for content that is intended for
multiple audiences. For example, a rendition of the "Treaty of
Waitangi," presented simultaneously in the original Maori and English
versions, would call for
Content-Language: mi, en
如果您转到 http://validator.w3.org/check 并尝试验证这一点:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-Language" content="en,hu">
<meta charset="UTF-8">
</head>
<body>
<p>Test</p>
</body>
</html>
W3 验证器工具说:
Line 5, Column 52: Using the meta element to specify the document-wide default language is obsolete. Consider specifying the language on the root element instead.
然后,如果 html 标签上的 lang 属性不允许使用多种语言,我认为你最好的尝试是在 HTTP header
中指定它lang
属性可以放在任何元素上,而不仅仅是根 html
元素或 meta name="description"
。所以你可以写 <html lang="en"><body>The Chinese translation of Stack Overflow is <span lang="zh-Hans">堆叠溢位</span></body></html>
并且最好把那些 lang
属性放进去因为它可以帮助视觉浏览器选择正确的字体和音频浏览器来帮助盲人选择正确的声音。
一些非 Google 搜索引擎仍然需要过时的 <meta http-equiv="content-language">
标记(特别是 Bing 并且据报道百度仍然需要这些)但我不知道它们的实现是否符合标准-足够兼容http-equiv="content-language"
中列出的两种或多种语言(试试看)。
至于搜索引擎是否会接受多种语言的 meta name="description"
的多个实例(具有适当的 lang
属性),这取决于搜索引擎。 Google 表示他们不喜欢并排翻译,这对于我们这些讨论外语的人来说是一种遗憾。