What is the Language Attribute?
In HTML, the language declaration is an attribute that states the language of the page 's content. It looks like this:
<html lang="">... </html>
When defining the content of the lang tag, use the ISO 639-1 language codes.
For English, the tag would look like this:
While the tag for French would be this:
This HTML attribute is used by various programs, search engines included, to help figure out what language page is written in. This is helpful when trying to match the right content to the right user.
Does the Language Attribute Matter in SEO?
The HTML lang attribute does not have much impact on SEO when it comes to Google. Google has explicitly said they ignore the tag in favor of hreflang tags for multilingual sites. Here 's Google 's John Mueller saying so in a Webmaster Hangout:
So if that 's the case, can you ignore language declaration completely?
While Google doesn 't look at language tags, Bing does.
In fact, Bing doesn 't use the hreflang tag when matching user language to page content. It uses what 's called the "content-language" meta tag in the <head> of a document.
You can check your language has been properly declared by running a Free WooRank Review.
What is the "content-language" Meta Tag?
The "content-language" tag is a meta tag in the <head> of an HTML document that states the language and country of that a page 's content is most relevant for.
The tag looks like this:
<meta http-equiv="content-language" content="">
The content attribute is where you will define the language and country. So for American English, it would look like this:
<meta http-equiv="content-language" content="en-us">
When setting the language, follow the 2-letter ISO 639 language code, just as you would for the HTML language tag. Language should be followed by the country 's ISO 3166 code.
- French in France: fr-fr
- French in Canada: fr-ca
- French in Belgium: fr-be
- Spanish in Spain: es-es
- Spanish in Mexico: es-mx
While Bing will also take a look at the <html> tag, but places a priority on the <meta> tag.
Common Language Declaration Errors
Even though using the language declaration HTML attribute won 't make your site rank higher, it 's still best practice to include it for usability and accessibility reasons. Here are the most common mistakes made when using the language declaration attribute.
Using the wrong language code
When declaring a language, you have to use the ISO 639-1 language codes. One of the most common mistakes is getting these codes wrong.
Probably the mistake that 's made the most is to use eng for English instead of en. Some other common errors include:
- Using ch for Chinese instead of zh
- Using sp for Spanish instead of es
- Using be for Bengali instead of bn
And then, of course, there are your general typos like using something like ft for French instead of fr.
Errors with country codes
You can add a country code to your HTML lang attribute when necessary, like when differentiating between American and British English or French and Canadian French.
To do this properly, simply add the country after the language using a dash, like this:
That specifies the language of the page in American English (so none of those pesky extra u 's).
The most common mistake when adding country codes, like with the language code, is to use the wrong code. Valid country codes use the ISO 3166-1 standard.
Another common mistake people make when adding country codes is to put the country first, like this:
Remember, the language always has to come before the country code.