Agent Wranglers

HTML basics Required

Say the page's language

Set the page's language on the <html> element of every page, such as lang="en", using a standard language code (BCP 47).

How to do it

Set lang in the shared template from one site setting. Use the content's language. Add a region only if it matters (en, en-GB).

Example

<html lang="en">
<!-- or, when the region matters -->
<html lang="en-GB">

How to check

A build gate finds <html lang="…"> with a valid BCP 47 code on every page. Lighthouse and axe html-has-lang and html-lang-valid pass.

Measured

On a reference site, removing it dropped Lighthouse Accessibility from 100 to 96.

For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/html-basics/html-lang.