Find us at BrightonSEO 25/26 April - STAND 18! Fill your swag bag!

Dealing with International issues?

Crawl your website with Sitebulb for 300+ tech SEO checks

Try for Free
High This Hint is very important, and definitely warrants attention. Issue This Hint represents an error or problem that needs to be fixed.

Invalid HTML lang attribute

This means that the URL in question has defined the language/region attribute using HTML lang, but either the language code or the geography code is invalid (or both are invalid). 

Why is this important?

Some search engines, such as Bing, use the HTML lang attribute to help them determine which URLs to display in regional search results.

The "content" attribute is comprised of a 2-letter language code, followed by a dash and the appropriate geography code. For example:

  • de-at: German, Austria
  • de-de: German, Germany
  • en-us: English, United States

In order to be considered valid, and recognised by search engines, the attribute value must conform to certain guidelines:

  • The language code must be in ISO 639-1 format.
  • The region code in your hreflang attribute must be in ISO 3166-1 format.
  • Hypens must separate the language and region codes.
  • The region code must not be used on its own (the language code can be).
  • When used together, the language code must always proceed the region code.

If HTML lang does not conform to any of the above, it will not be recognised by search engines.

What does the Hint check?

This Hint will trigger for any URL that uses an invalid HTML lang attribute.

Examples that trigger this Hint:

Consider the URL: https://example.com/en/page-a/

The Hint would trigger for this URL if it had an invalid HTML lang attribute:

<meta http-equiv="content-language" content="en-uk">

(where "en-uk" is invalid - it should be "en-gb")

How do you resolve this issue?

Invalid HTML lang will cause you issues in search engines that still support HTML lang (e.g. Bing), and they won't  serve the correct localised content in different regions.

However, if you have set up hreflang correctly, this will supersede HTML lang (valid or not) for search engines that use hreflang (e.g. Google).

Further Reading

Sitebulb Desktop

Find, fix and communicate technical issues with easy visuals, in-depth insights, & prioritized recommendations across 300+ SEO issues.

  • Ideal for SEO professionals, consultants & marketing agencies.

Sitebulb Cloud

Get all the capability of Sitebulb Desktop, accessible via your web browser. Crawl at scale without project, crawl credit, or machine limits.

  • Perfect for collaboration, remote teams & extreme scale.