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

2

8

I've a project were I can only add code beneath the <html>-tag but it's important that the language is in the header for SEO and some other stuff.

So my question is:

What is the priority/ranking of

<html lang="de-DE"> 

vs

<meta http-equiv="language" content="DE">
Federative answered 23/2, 2016 at 11:8 Comment(1)
developer.mozilla.org/en-US/docs/Web/HTML/Element/…. [QUOTE]Use the global lang attribute on the <body> element instead. [/UNQUOTE].Andrel
D
5

According to 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.

so from an SEO point of view it shouldn't matter. It's actually more important to put the language in the 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.

Given that the meta tag is obsolete (see Rahul Tripathi's answer) and you can't add the html 5 equivalent. I simply wouldn't bother.


If your site is multilingual then you should consider implementing hreflang tags to redirect users of the languages you wish to target to the correct language page.

See google docs here

Dambro answered 23/2, 2016 at 11:18 Comment(6)
Wow thanks for all the informations. Seems that both lang-tags are obsolete cause google analyzes the body-part to check the lang. But does it matter to the google translation tool? I mean when you visit a site with another language and chrome tries to translate the page, do I need the lang-tag for this?Federative
Do you mean using chrome? google (the search engine) doesn't auto translate anything.Dambro
I'm not 100% sure. I believe that this uses the same mechanism as above (i.e. it detects the language from the words) but it will also depend on how the user of chrome has configured their browser. I would suggest that, asking that separately to this (really it's a different topic) may be a good idea. I had trouble finding any good resources on the topic.Dambro
Ok, I'll ask this on a new topicFederative
BTW, I'm not 100% sure this would count as a programming question so be a bit careful how you word it. May save you a linching...Dambro
Here's the new topic linkFederative
A
5

From HTML5 the meta http-equiv="Language" is obsolete. You should better use the <html lang="de-DE"> attribute.

Refer this: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.

The specification about Content-Language tells that:

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.

Abraham answered 23/2, 2016 at 11:12 Comment(0)
D
5

According to 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.

so from an SEO point of view it shouldn't matter. It's actually more important to put the language in the 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.

Given that the meta tag is obsolete (see Rahul Tripathi's answer) and you can't add the html 5 equivalent. I simply wouldn't bother.


If your site is multilingual then you should consider implementing hreflang tags to redirect users of the languages you wish to target to the correct language page.

See google docs here

Dambro answered 23/2, 2016 at 11:18 Comment(6)
Wow thanks for all the informations. Seems that both lang-tags are obsolete cause google analyzes the body-part to check the lang. But does it matter to the google translation tool? I mean when you visit a site with another language and chrome tries to translate the page, do I need the lang-tag for this?Federative
Do you mean using chrome? google (the search engine) doesn't auto translate anything.Dambro
I'm not 100% sure. I believe that this uses the same mechanism as above (i.e. it detects the language from the words) but it will also depend on how the user of chrome has configured their browser. I would suggest that, asking that separately to this (really it's a different topic) may be a good idea. I had trouble finding any good resources on the topic.Dambro
Ok, I'll ask this on a new topicFederative
BTW, I'm not 100% sure this would count as a programming question so be a bit careful how you word it. May save you a linching...Dambro
Here's the new topic linkFederative

© 2022 - 2024 — McMap. All rights reserved.