On-page
Page language: set the lang attribute
The lang attribute on the html element tells browsers, screen readers and search engines which language the page is in. Set it once in your layout.
- Category
- On-page
- Points available
- 2 pts
- Effort
- Quick fix
Why it matters
Screen readers use it to pick the right pronunciation. Browsers use it to offer translation and to apply language-specific typography such as hyphenation.
Search engines mainly detect language from content, but a correct lang removes doubt, especially on short pages.
How we measure it
We read the lang attribute of the <html> element. Any value of at least two characters (like en or tr-TR) passes.
| Result | Points |
|---|---|
| lang attribute present | 2 |
| Missing or empty | 0 |
How to fix it
- Add
langto the<html>tag in your base layout, using a language code likeen,trorde-AT. - On multilingual sites, set it per page to the language of that page.
Copy-paste fixes
<!doctype html>
<html lang="en"><html <?php language_attributes(); ?>><html class="no-js" lang="{{ request.locale.iso_code }}">export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}Common mistakes
- Leaving
lang="en"from a theme on a site written in Turkish or German. - Using a country code instead of a language code (
lang="uk"means Ukrainian, not British English).
Test your site now
Put your site against a competitor and see how many of these points you earn, and which fixes pay off first.
← All checksUpdated December 1, 2026