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: https://example.com/en/page-a/

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

6 views

Recent Posts

See All

ClubReq Gets A Link (Because They Asked)

I am a mentor for Techstars and have been for over 10 years. In those ten years I have mentioned to startups to ask ANYONE and everyone that they meet to link to their site. Yet, in all those times on

Comentários


bottom of page