top of page
  • Writer's pictureBrent Payne

Invalid HTML lang attribute

The designated URL has specified a language and possibly a geographic code through the HTML lang attribute, yet one or both of these values could be incorrect.

Why is this important?

Certain search engines, like Bing, leverage the HTML lang attribute to ascertain which URLs are presented in region-specific search outcomes.

The "content" attribute includes a two-letter code for language, a dash, and then a code for the region, such as:

  • de-at: German, Austria

  • de-de: German, Germany

  • en-us: English, United States

To be valid and recognized by search engines, the HTML lang values should adhere to the following stipulations:

  • Language codes should comply with the ISO 639-1 standard.

  • Geography codes should align with the ISO 3166-1 specification.

  • A hyphen must bridge the two codes.

  • One must not utilize the region code in isolation, though the language code may stand alone.

  • The language code should always be listed prior to the region code.

An HTML lang that diverges from these norms won't be recognized by search engines.

What does the Optimization check?

The Optimization gets activated for URLs that feature an improper HTML lang attribute.

Examples that trigger this Optimization:

Reflect on the URL:

The Optimization would fire for this URL if it exhibited an incorrect HTML lang designation:

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

(where "en-uk" is not valid - the correct code is "en-gb")

How do you resolve this issue?

An invalid HTML lang can create difficulties in search engine indexing, especially those that recognize HTML lang for delivering regionally pertinent content.

Nevertheless, implementing hreflang correctly will take precedence over HTML lang for search engines that prioritize hreflang, like Google.

Further Reading

0 views0 comments

Recent Posts

See All

The skip-link target should exist and be focusable

At Loud Interactive, we're committed to ensuring that digital accessibility is at the forefront of website design and development. During our SEO audits, we look for and attempt to identify an area of

Timed meta refresh must not exist

At Loud Interactive, we regularly perform a SEO audits. We often stumble upon an important issue that could significantly impact user experience and accessibility on websites. We're talking about the

bottom of page