HTML basics Required
Start every page with the doctype
Start every HTML page with <!doctype html> as its very first bytes, so browsers use standards mode (the modern, predictable way of laying out pages).
How to do it
Put <!doctype html> in the one template every page shares. That includes error, maintenance and offline pages. Make the build fail if any page does not start with it.
Example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page name · Example</title>
</head>
<body>…</body>
</html>
How to check
curl -s URL | head -c 15 prints <!doctype html>. Lighthouse's doctype audit passes.
Measured
On a reference site, removing it dropped Lighthouse Best Practices 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/doctype.