AI disclosure: I wrote this article with AI assistance (Claude). The script is a trimmed-down version of an auditor we maintain, and every line of output below comes from running it on 2026-11-23. We reviewed and tested everything.
Most "SEO audit" problems that actually cost you traffic are boring: a template that ships the same <title> on 400 pages, a staging noindex that made it to production, a canonical that points at the homepage, hreflang tags that forget the page itself. None of that needs Lighthouse or a headless browser to find. It's all in the raw HTML and response headers, so one plain GET per URL is enough.
This post builds a standalone Node script (Node 18+ and cheerio, about 130 lines) that checks a list of URLs against a small rule table, runs it on 10 public sites, and then goes through the two bugs I found in my own script while doing it.
The checklist
These are the rules the script checks. The thresholds are common rules of thumb, not Google requirements, and I'll come back to that.
| Check | Rule (severity) | Why it matters |
|---|---|---|
<title> | Missing: error. Under 30 or over 60 characters: warning | The title is usually the clickable headline in search results. Google truncates by pixel width (roughly 600 px), and about 60 characters is a safe proxy. Very short titles waste the slot. |
| Meta description | Missing: error. Under 70 or over 160 characters: warning | Google often uses it as the snippet. It isn't a ranking factor, but it affects click-through. Long ones get cut off with "...". |
rel="canonical" | Missing: warning. Points to a different URL: notice | Tells search engines which URL is the "real" one when the same content is reachable at several URLs (tracking params, http/https, trailing slashes). A canonical that points somewhere else is sometimes intended, and sometimes a template bug that deindexes a whole section. |
noindex | In <meta name="robots"> or the X-Robots-Tag header: error | The classic production accident. The header version is easy to miss because it's not in the HTML at all. |
<h1> count | None: error. More than one: notice | One clear main heading helps users and parsers. Google says several <h1>s are fine, so this is only a notice. |
| Open Graph | og:title, og:description or og:image missing: notice | Controls the preview card on LinkedIn, Slack, Facebook, Discord and so on. Not a ranking signal, but a page without og:image shares badly. |
| hreflang | No self-referencing entry: warning. No x-default: notice | Each language version must list itself as well as its alternates, or search engines may ignore the whole set. x-default covers users whose language you don't target. |
Image alt | <img> with no alt attribute at all: warning | Accessibility first, image search second. alt="" is correct for decorative images, so the script only counts images where the attribute is missing completely. |
| HTTP status | 400 or above: error | Obvious, but bulk lists of URLs from old sitemaps are full of 404s. |
The script
Save this as audit.mjs, run npm i cheerio, then node audit.mjs site1.com https://site2.com/page. Add --json for machine-readable output.
// audit.mjs: bulk on-page SEO meta audit over plain HTTP. // Usage: node audit.mjs example.com https://other.site/page [--json] // Needs Node 18+ and `npm i cheerio`. import * as cheerio from 'cheerio'; const UA = 'Mozilla/5.0 (compatible; MetaAuditScript/1.0)'; const RULES = { titleMin: 30, titleMax: 60, descMin: 70, descMax: 160 }; const txt = (s) => (s || '').replace(/\s+/g, ' ').trim(); async function get(url, timeoutMs = 15000) { const ctrl = new AbortController(); const timer = setTimeout(() => ctrl.abort(), timeoutMs); const t0 = Date.now(); try { const res = await fetch(url, { redirect: 'follow', signal: ctrl.signal, headers: { 'user-agent': UA, accept: 'text/html,*/*;q=0.8', 'accept-language': 'en-US,en;q=0.8' }, }); const body = (await res.text()).slice(0, 5_000_000); return { status: res.status, finalUrl: res.url, headers: res.headers, body, ms: Date.now() - t0 }; } finally { clearTimeout(timer); } } // Small robots.txt check for the "User-agent: *" group. Supports * and $ wildcards; // the longest matching rule wins, Allow wins ties (as in RFC 9309). const ruleToRegex = (v) => new RegExp('^' + v.replace(/[.+?^{}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*').replace(/\\?\$$/, '$')); async function robotsAllows(url) { const u = new URL(url); const path = u.pathname + u.search; try { const r = await get(`${u.origin}/robots.txt`, 8000); if (r.status !== 200) return true; let inStar = false, lastWasAgent = false, best = null; for (const line of r.body.split(/\r?\n/)) { const [k, ...rest] = line.replace(/#.*/, '').split(':'); const key = k.trim().toLowerCase(), val = rest.join(':').trim(); if (key === 'user-agent') { inStar = (lastWasAgent && inStar) || val === '*'; // consecutive UA lines share one group lastWasAgent = true; continue; } if (key) lastWasAgent = false; if (inStar && (key === 'allow' || key === 'disallow') && val && ruleToRegex(val).test(path)) { const allow = key === 'allow'; if (!best || val.length > best.len || (val.length === best.len && allow)) best = { allow, len: val.length }; } } return !best || best.allow; } catch { return true; } } function audit({ status, finalUrl, headers, body }) { const $ = cheerio.load(body); const issues = []; const add = (sev, code, msg) => issues.push({ sev, code, msg }); const title = txt($('head title').first().text()); const desc = txt($('meta[name="description" i]').attr('content')); const canonical = $('link[rel="canonical" i]').attr('href'); const robots = (txt($('meta[name="robots" i]').attr('content')) + ' ' + (headers.get('x-robots-tag') || '')).toLowerCase(); const h1 = $('h1').map((_, e) => txt($(e).text())).get(); // The OG spec says property="og:*"; some sites use name="og:*". Read both, flag the second. const og = {}; let ogByName = 0; $('meta[property^="og:"], meta[name^="og:"]').each((_, e) => { const key = ($(e).attr('property') || $(e).attr('name')).slice(3); if (!$(e).attr('property')) ogByName++; og[key] ??= $(e).attr('content'); }); const hreflang = $('link[rel="alternate" i][hreflang]').map((_, e) => ({ lang: $(e).attr('hreflang'), href: $(e).attr('href') })).get(); const imgs = $('img'); const noAlt = imgs.filter((_, e) => $(e).attr('alt') === undefined).length; // alt="" is valid for decorative images if (status >= 400) add('error', 'http-error', `HTTP ${status}`); if (!title) add('error', 'missing-title', 'no <title>'); else if (title.length < RULES.titleMin || title.length > RULES.titleMax) add('warn', 'title-length', `title is ${title.length} chars`); if (!desc) add('error', 'missing-description', 'no meta description'); else if (desc.length < RULES.descMin || desc.length > RULES.descMax) add('warn', 'description-length', `description is ${desc.length} chars`); if (!canonical) add('warn', 'missing-canonical', 'no rel=canonical'); else { const abs = new URL(canonical, finalUrl).href; if (abs !== finalUrl) add('notice', 'canonical-elsewhere', `canonical -> ${abs}`); } if (robots.includes('noindex')) add('error', 'noindex', 'page is noindex'); if (h1.length === 0) add('error', 'no-h1', 'no <h1>'); else if (h1.length > 1) add('notice', 'multiple-h1', `${h1.length} <h1> tags`); const ogMissing = ['title', 'description', 'image'].filter((k) => !og[k]); if (ogMissing.length) add('notice', 'open-graph', `og:${ogMissing.join(', og:')} missing`); if (ogByName) add('notice', 'og-name-attr', `${ogByName} og: tags use name= instead of property=`); if (hreflang.length) { const self = hreflang.some((h) => { try { return new URL(h.href, finalUrl).href === finalUrl; } catch { return false; } }); if (!self) add('warn', 'hreflang-no-self', `${hreflang.length} hreflang links, none points to this URL`); if (!hreflang.some((h) => h.lang === 'x-default')) add('notice', 'hreflang-no-x-default', 'no x-default'); } if (noAlt) add('warn', 'img-alt', `${noAlt} of ${imgs.length} <img> without alt`); return { finalUrl, status, title, titleLen: title.length, descLen: desc.length, h1: h1.length, hreflang: hreflang.length, images: imgs.length, issues }; } const args = process.argv.slice(2); const asJson = args.includes('--json'); const urls = args.filter((a) => !a.startsWith('--')).map((a) => (/^https?:\/\//.test(a) ? a : `https://${a}`)); const out = []; const t0 = Date.now(); for (const url of urls) { // sequential on purpose: one request at a time if (!(await robotsAllows(url))) { out.push({ url, skipped: 'disallowed by robots.txt' }); continue; } try { const page = await get(url); out.push({ url, ms: page.ms, ...audit(page) }); } catch (err) { out.push({ url, error: err.name === 'AbortError' ? 'timeout' : err.message }); } await new Promise((r) => setTimeout(r, 500)); // be polite between sites } if (asJson) console.log(JSON.stringify(out, null, 2)); else { for (const r of out) { if (r.skipped || r.error) { console.log(`${r.url}\n SKIPPED: ${r.skipped || r.error}\n`); continue; } console.log(`${r.url} -> ${r.finalUrl} (${r.status}, ${r.ms} ms)`); console.log(` title ${r.titleLen} ch | description ${r.descLen} ch | h1 x${r.h1} | hreflang ${r.hreflang} | img ${r.images}`); for (const i of r.issues) console.log(` ${i.sev.padEnd(6)} ${i.code.padEnd(22)} ${i.msg}`); if (!r.issues.length) console.log(' no issues'); console.log(''); } console.log(`${out.length} URLs in ${((Date.now() - t0) / 1000).toFixed(1)} s`); } A few deliberate choices:
- Sequential, with a 500 ms pause. For an audit you don't need speed, and hammering a site with parallel requests is the quickest way to get a
429or a block page instead of real HTML. -
robots.txtis checked before every URL. It's a small parser: only theUser-agent: *group, with*and$wildcards and "longest match wins". More on why that matters below. - Cheerio, not regex, for the HTML. In the tech-stack post I used regex because I only needed attribute values. Here I need things like "the
<title>inside<head>, not an SVG<title>", which regex gets wrong easily. -
X-Robots-Tagis merged with the meta robots tag, because anoindexin a header is invisible if you only look at the HTML.
A real run on 10 sites
I picked a mix of docs sites, a CMS, a government site, a news site, a payments company and one client-side app. This is the unedited output from 2026-11-23:
https://developer.mozilla.org/en-US/ -> https://developer.mozilla.org/en-US/ (200, 74 ms) title 12 ch | description 145 ch | h1 x1 | hreflang 0 | img 1 warn title-length title is 12 chars notice og-name-attr 10 og: tags use name= instead of property= https://wordpress.org -> https://wordpress.org/ (200, 407 ms) title 55 ch | description 90 ch | h1 x1 | hreflang 157 | img 16 no issues https://nextjs.org -> https://nextjs.org/ (200, 165 ms) title 39 ch | description 64 ch | h1 x1 | hreflang 0 | img 17 warn description-length description is 64 chars https://www.python.org -> https://www.python.org/ (200, 73 ms) title 21 ch | description 52 ch | h1 x5 | hreflang 0 | img 1 warn title-length title is 21 chars warn description-length description is 52 chars warn missing-canonical no rel=canonical notice multiple-h1 5 <h1> tags https://www.gov.uk -> https://www.gov.uk/ (200, 73 ms) title 17 ch | description 68 ch | h1 x1 | hreflang 0 | img 4 warn title-length title is 17 chars warn description-length description is 68 chars https://stripe.com -> https://stripe.com/en-es (200, 1009 ms) title 54 ch | description 148 ch | h1 x2 | hreflang 89 | img 31 notice multiple-h1 2 <h1> tags https://www.wikipedia.org -> https://www.wikipedia.org/ (200, 181 ms) title 9 ch | description 130 ch | h1 x1 | hreflang 0 | img 7 warn title-length title is 9 chars warn missing-canonical no rel=canonical https://web.dev -> https://web.dev/ (200, 13906 ms) title 7 ch | description 66 ch | h1 x0 | hreflang 44 | img 10 warn title-length title is 7 chars warn description-length description is 66 chars error no-h1 no <h1> https://app.netlify.com -> https://app.netlify.com/ (200, 333 ms) title 7 ch | description 102 ch | h1 x0 | hreflang 0 | img 0 warn title-length title is 7 chars warn missing-canonical no rel=canonical error no-h1 no <h1> https://www.bbc.com/news -> https://www.bbc.com/news (200, 157 ms) title 93 ch | description 249 ch | h1 x1 | hreflang 2 | img 44 warn title-length title is 93 chars warn description-length description is 249 chars notice open-graph og:image missing notice hreflang-no-x-default no x-default warn img-alt 22 of 44 <img> without alt 10 URLs in 26.9 s 

