Fast Links

How to fix URLs with HTML lang attribute invalid

How to fix URLs with HTML lang attribute invalid

HTML lang attribute invalid issue means that URLs where the language (or language-location) code declared in the HTML lang tag () is invalid.

Why It’s 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 consists of a 2-letter language code and optionally by a dash and the appropriate geography code. For example:

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

You can check more details here.

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 Alfa-2 format.
  • Hyphens 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 precede the region code.

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

How to Check the Issue?

Check the source code. Access the page with your Chrome browser, right-click it, and pick “View page source” (this method differs in other browsers). This simple online tool will also help you access the source code.

To locate the HTML lang attribute, look for html lang, and check it.

How to Fix the Issue?

Find invalid language code and update it. For example, “en-uk” is not a valid language-region code for the United Kingdom. It must be “en-gb” instead.

Check Your Website for SEO Errors

No limits! Upgrade your account to crawl this domain