Static sites rot quietly. You add a page, forget a meta description, break the nav on one file, your JSON-LD stops parsing — and nothing tells you. Lighthouse is great but heavy, needs Chrome, and won't check your site's specific contracts (like "every tool page must link the privacy policy").
So I wrote a single-file audit script: 403 deterministic checks, ~130 lines, zero dependencies, runs in 3 seconds offline. Here's the approach.
The idea: checks as regex + tiny helpers
No headless browser, no HTML parser. For a static site you control, tolerant regex over the raw HTML covers 95% of what matters:
function check(file, name, ok) {
total++;
if (ok) passed++;
else fails.push(`${file}: ${name}`);
}
const title = get(/<title>([^<]*)<\/title>/i, raw);
check(f, 'title 15-65 chars', !!title && title.trim().length >= 15 && title.trim().length <= 65);
check(f, 'canonical', /<link\s+rel="canonical"/i.test(raw));
// a11y: every input needs a label
const inputIds = [...raw.matchAll(/<(?:input|select)[^>]*\bid="([^"]+)"/gi)].map(m => m[1]);
const labelFors = new Set([...raw.matchAll(/<label[^>]*\bfor="([^"]+)"/gi)].map(m => m[1]));
check(f, 'every input has a label', inputIds.every(id => labelFors.has(id)));
Checks that caught real bugs
JSON-LD must parse. I once pasted a schema block after </head>. Valid-looking page, dead structured data:
const ld = [...raw.matchAll(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/gi)];
check(f, 'JSON-LD parses', ld.length > 0 && ld.every(m => { try { JSON.parse(m[1]); return true; } catch { return false; } }));
WCAG contrast from your own palette. Parse :root hex variables, compute relative luminance, assert 4.5:1.
Link-grid consistency. Every page must share the identical nav set, and the homepage must link every tool page. I was maintaining this by hand and missed one — now it's a check.
Thin-content guard. Word-count per page; under 300 words a tool page fails. Ad networks reject thin pages, and so do readers.
The rule that made it work
Every real bug becomes a permanent check, same day. Misplaced schema → structure check. Hand-checked navigation → link-grid check. Slow bloat → 15 KB/page byte budget. The audit grew from 114 to 403 checks while the site stayed at 100%.
Result
- 9 pages (bilingual portfolio + 6 calculator tools), ~60 KB total, no frameworks
- one command →
METRIC quality=100, 3 s, fully offline - Live: https://trixer666.github.io (calculators in Polish — the audit pattern is universal)
- The automation/radar code that feeds my freelance pipeline: https://github.com/trixer666/income-radar
Questions about specific checks welcome — happy to paste more in the comments.
Top comments (0)