<html lang="de-DE"> 等于 <meta http-equiv="language" content="DE"> 吗?

Is <html lang="de-DE"> equal to <meta http-equiv="language" content="DE">?

我有一个项目,我只能在 <html> 标签下添加代码,但语言在 header 中对于 SEO 和其他一些东西很重要。

所以我的问题是:

的 priority/ranking 是什么
<html lang="de-DE"> 

对比

<meta http-equiv="language" content="DE">

从 HTML5 开始,meta http-equiv="Language" 已过时。你最好使用 <html lang="de-DE"> 属性。

参考这个:For HTML, should we put language declarations in HTTP headers and meta elements, and how are they different from those in language attributes?

The HTTP Content-Language header can be used to provide metadata about the intended audience of the page, and can indicate that this is more than one language. The Content-Language value for an http-equiv attribute on a meta element should no longer be used. You should use a language attribute on the html tag to declare the default language of the actual text in the page.

关于Content-Language的规范告诉我们:

The Content-Language entity-header field describes the natural language(s) of the intended audience for the enclosed entity. Note that this might not be equivalent to all the languages used within the entity-body.

根据Google Multi-regional guidelines

Google uses only the visible content of your page to determine its language. We don’t use any code-level language information such as lang attributes.

所以从 SEO 的角度来看,不应该 重要。把语言放在 URL:

其实更重要

Google uses the content of the page to determine its language, but the URL itself provides human users with useful clues about the page’s content. For example, the following .ca URLs use fr as a subdomain or subdirectory to clearly indicate French content: http://example.ca/fr/vélo-de-montagne.html and http://fr.example.ca/vélo-de-montagne.html.

鉴于元标记已过时(参见 )并且您无法添加 html 5 等价物。我根本不会打扰。


如果您的网站是多语言的,那么您应该考虑实施 hreflang 标记,将使用您希望定位的语言的用户重定向到正确的语言页面。

See google docs here