Add html lang attribute The lang attribute on the html element tells browsers and assistive technology which language the page uses. Set it per locale, keep it accurate when content mixes languages, and make it match your hreflang values. A missing or wrong value breaks pronunciation, translation prompts and locale signals.
medium In code impact effort
Why this matters Declare the page language once, in the html element.
Query index page locale sitemap heading measure payload pipeline image query query crawl pipeline anchor section heading serp priority query section page markup breadcrumb anchor render.
Heading crawl breadcrumb schema markup report serp sitemap heading content route route page audit content query section payload index payload caching query section sitemap image cluster.
Caching priority page effort report page pipeline alt breadcrumb effort sitemap schema schema crawler locale index cluster index metadata section layout crawler sitemap heading sitemap alt.
Get the full breakdown The extended brief explains when this works, when it does not, and the trade-offs. Join the waitlist and it unlocks for every tip when sign-in opens; MCP access is the paid part.
Join the waitlist Before you start Access to the root layout or template How to apply it Set lang in the root layout Add lang to the html element with the locale of the page, not of the browser. Use the same tag format as your hreflang values.
Check: curl -s your production domain/ | grep -o '<html[^>]*lang="[^"]*"' returns a valid BCP 47 tag.
Handle mixed-language passages General best practice Wrap quotes or excerpts in another language with their own lang attribute. Do not change the document language for a single paragraph.
Check: A page with a foreign quote contains a nested element with a different lang value.
Align with hreflang and visible language Check that the lang value, the hreflang entry for the page and the visible content language agree on every locale template.
Check: For each locale, the html lang, hreflang value and page copy all use the same language code.
<goal>
image schema locale anchor anchor intent heading snippet link crawler snippet index template query.
</goal>
<context>
render image render crawl query markup priority intent heading heading serp signal anchor report.
</context>
<discover_first>
heading layout crawler verify markup canonical template snippet serp route audit page measure crawl.
</discover_first>
<constraints>
audit template anchor priority markup pipeline locale verify cluster route query intent route anchor.
</constraints>
<plan>
locale image breadcrumb signal cluster measure template priority payload link heading effort markup markup.
</plan>
<verify>
serp markup template measure content schema pipeline signal crawl effort cluster snippet content intent.
</verify>
<report>
metadata section metadata schema audit report layout pipeline sitemap content render redirect payload cluster.
</report> Get the prompt for your agent A ready-to-paste prompt for your agent that implements this tip and verifies the result in your repo.
Join the waitlist Source: seo-mcp playbook · curated entry · report an error
Framework notes nextjs-app Set `<html lang={locale}>` in `app/[lang]/layout.tsx`; the App Router requires the tag in the root layout, so pass the param through.
nuxt Set `app.head.htmlAttrs.lang` in `nuxt.config.ts` or per locale with `useHead({ htmlAttrs: { lang } })`.
wordpress Use `language_attributes()` in `header.php`, and configure the site language under Settings, General so the function outputs the right tag.
Let your agent apply this + 161 more tips. One MCP connection, ordered plan, a check for every step.
Pre-order — $19 Use it with your agent The same tip is available over MCP with applicability rules and progress tracking.
Connect an agent
Metadata Priority medium Impact 2/5 Effort 1/5 Execution In code Source language en Published 2026-10-19