HTML meta tag for content language

What is the difference between the two HTML meta tags for specifying the contents of a webpage in Spain:

<meta name="language" content="Spanish"> 

and

 <meta http-equiv="content-language" content="es"> 
+46
html
Dec 11 '10 at 17:21
source share
4 answers

<meta name="language" content="Spanish">

This is not defined in any specification (including the HTML5 project )

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

This is the bad person version of the real HTTP header and should really be expressed in the headers. For example:

 Content-language: es Content-type: text/html;charset=UTF-8 

It states that the document is intended for speakers of Spanish (it does not mean, however, that the document is written in Spanish, it can, for example, be written in English as part of a language course for Spanish speakers).

From the specification :

The Content-Language object header field describes the natural language of the target audience for the closed object. Note that this may not be equivalent to all languages ​​used in the entity.

If you want to indicate that the document is written in Spanish, use:

 <html lang="es"> 
+79
Dec 11 '10 at 17:24
source share
β€” -

You asked for a difference, but you cannot compare the two.

Please note that <meta http-equiv="content-language" content="es"> deprecated and removed in HTML5. It was used to specify the "default language for the entire document" with its http-equiv attribute, which makes it a pragma directive (which mimics the HTTP response header, for example Content-Language , which was not sent from the server because it cannot override the real one) .

Regarding <meta name="language" content="Spanish"> , you are unlikely to find reliable information. Its non-standard and was probably invented as SEO non-specialized .

However, the HTML5 W3C Recommendation recommends that authors use lang in the root html elements (attribute values ​​must have valid BCP 47 tags :

 <!DOCTYPE html> <html lang="es-ES"> <head> … 

In any case, if you want to specify the language of the content for instructing search engine robots, you should consider this quote from the Google Search Console Help on multilingual sites :

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

+24
Feb 12 '14 at 10:53
source share

Google recommends using hreflang, read more

Examples:

 <link rel="alternate" href="http://example.com/en-ie" hreflang="en-ie" /> <link rel="alternate" href="http://example.com/en-ca" hreflang="en-ca" /> <link rel="alternate" href="http://example.com/en-au" hreflang="en-au" /> <link rel="alternate" href="http://example.com/en" hreflang="en" /> 
+4
Dec 19 '14 at 6:15
source share

Html5 is also recommended to use <html lang="es-ES"> Only the following is indicated in the small letter lang tag: language code The capital letter indicates: country code

This is really useful for ie.Chrome when the browser offers to translate web content (i.e. google translate)

+2
Oct 28 '16 at 14:46
source share



All Articles