DEV Community

agebreakco-prog
agebreakco-prog

Posted on Edited on

I ran a 130-line SEO meta tag audit on 10 well-known sites. Here's what it flagged (and where it was wrong)

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`);
}
Enter fullscreen mode Exit fullscreen mode

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 429 or a block page instead of real HTML.
  • robots.txt is checked before every URL. It's a small parser: only the User-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-Tag is merged with the meta robots tag, because a noindex in 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
Enter fullscreen mode Exit fullscreen mode

Before I read anything into this: a warning here means "doesn't match my rule table", not "this site has bad SEO". These are some of the best-known sites on the web, and most of them rank fine. What the output is good for is spotting patterns across many URLs of your own site.

With that in mind:

  • wordpress.org passed every check, including 157 hreflang links with a self-reference and an x-default. That's what a well-maintained template looks like.
  • Short homepage titles are everywhere: Wikipedia (9 characters), Netlify (7), web.dev (7), MDN Web Docs (12), Welcome to Python.org (21). For a brand homepage that people search for by name, a short title is a reasonable choice. On a product or article page it would be a real problem. If you run this on your own site, you'll probably want different thresholds for the homepage and for content pages.
  • python.org has five <h1> tags: "Functions Defined", "All the Flow You'd Expect", "Compound Data Types" and so on, one per slide in the homepage code carousel. It also has no canonical link. Neither is likely to hurt a site with python.org's authority, but on a smaller site both are worth fixing.
  • BBC News has a 93-character title and a 249-character description. Google will truncate both. It has og:title and og:description but no og:image in the server HTML.
  • stripe.com redirected me to /en-es, because I ran this from Spain. The page is fine (89 hreflang links, self-reference included), but it's a reminder that what you audit depends on where you run the script from. More below.
  • web.dev and app.netlify.com have no <h1> in the raw HTML. For app.netlify.com that's expected: it's a client-side app, and the 7-character title Netlify is the whole server-rendered page as far as SEO tags go. I didn't check web.dev's rendered DOM, so all I can say is that the server response has no <h1>.
  • No site was noindex, which is good news for them but means the live run didn't exercise that rule. I tested it separately against a local server that sends X-Robots-Tag: noindex, a canonical to another path, an hreflang set without a self-reference and one <img> without alt. Every rule fired as expected.

Where my script was wrong

Bug 1: my robots.txt parser blocked three sites

My first version matched robots rules by prefix and simply cut each rule at the first *. The first run started like this:

https://developer.mozilla.org/en-US/
  SKIPPED: disallowed by robots.txt
Enter fullscreen mode Exit fullscreen mode

gov.uk and web.dev were skipped the same way. MDN's robots.txt has Disallow: /*/files/. Cut at the *, that becomes Disallow: /, which blocks the entire site. web.dev's Disallow: /*?*authuser= had the same problem.

The fix is to turn each rule into a real pattern (* becomes "anything", a trailing $ anchors the end) and pick the longest matching rule, with Allow winning ties. That's what RFC 9309 specifies, and it's what the version above does. The lesson: a robots parser that fails "closed" looks responsible but silently drops data. Test it against a few real robots.txt files.

Bug 2: MDN "had no Open Graph tags"

The first run reported og:title, og:description, og:image missing for MDN. MDN has all of them. It writes them as <meta name="og:title"> instead of <meta property="og:title">. The Open Graph spec uses property, but in practice many consumers accept both. The script now reads both and adds a separate notice when it sees the name= form. That's more honest than calling them missing.

Images "without alt" that aren't really images

BBC News shows 22 of 44 <img> without alt. Looking at the HTML, at least some of those are grey placeholder images with aria-label="image unavailable" and a hide-when-no-script class: lazy-loading stand-ins that JavaScript replaces. A raw-HTML audit counts them anyway. The count is still useful as a trend, but check a few by hand before you file a ticket.

Honest limits

  • JavaScript-rendered pages. If the title, meta tags or content are set by client-side JavaScript (many SPAs, React apps without SSR), plain HTTP sees the empty shell. That's what app.netlify.com looks like above. Google does render JavaScript, but later and not always fully, so tags that only exist after rendering are a risk in themselves. If you need to audit the rendered DOM, you need a headless browser, and you pay for it in time and memory.
  • robots.txt. The script respects User-agent: * rules and skips disallowed URLs. That's the right default, but it means some URLs in your list will come back as "skipped". The parser also ignores agent-specific groups and crawl-delay.
  • Rate limiting and bot protection. Big sites may answer a script with 429, 403 or a challenge page. The script reports what it gets, so a Cloudflare challenge page would show up as "missing description, no h1". If a site blocks you, record it and move on. Don't try to get around it.
  • Geo and language. Redirects like Stripe's /en-es mean the URL you audit isn't necessarily the one a US user or Googlebot sees. The accept-language header and your IP both matter.
  • One page, one moment. No crawling, no duplicate-title detection across pages, no Core Web Vitals, no structured data validation. Duplicate titles and descriptions across a site are one of the most useful checks in practice, and they need a crawl plus a map of title to URLs.
  • Thresholds are judgment calls. 30 to 60 and 70 to 160 characters are proxies for pixel width. Treat the warnings as a list to review, not a score to optimize.

Scaling it up

For a few dozen URLs, the script is enough. For a whole site you'll want:

  • A crawler that follows internal links (or reads the sitemap) up to a page limit and depth, with include/exclude patterns.
  • Site-level checks after the crawl: duplicate titles and descriptions, canonical chains, hreflang reciprocity between pages.
  • Limited concurrency (a few requests in parallel), a per-host delay, and retries with backoff on 429/5xx that honor Retry-After.
  • JSON or CSV output, one row per URL with the issue codes, so you can sort by "noindex" or filter for "title-length" in a spreadsheet.

If you'd rather not build the crawler

We run the bigger version of this as an Apify actor: SEO Audit & Meta Tag Checker. It crawls a site (or takes a list of URLs), checks everything above plus viewport, lang, thin content, structured data and duplicate titles/descriptions across pages, and outputs one row per page with a score and issue codes. Full disclosure: it's ours. It's free to use until December 6, 2026, and after that it's pay per use, about $3 per 1,000 pages audited. Failed pages aren't charged. It has the same limits described above, including no JavaScript rendering.

For a handful of URLs, though, the script above is all you need. Copy it, adjust the thresholds for your pages, and run it before your next deploy.


This script is one chapter's worth of a longer project: I collected this and the other no-headless-browser techniques (robots.txt, retries and throttling, RAG chunking, feeds, PDFs, public JSON APIs, RDAP and DNS checks) into a book, **Practical Web Data Extraction with Node.js. Every sample output comes from a real run. EPUB on Gumroad: https://agebreak.gumroad.com/l/pelkw (Kindle and Kobo editions coming this week).

Top comments (0)