Audits: performance, responsive and new mandatory items; seo-check content checks

ipal-audit: <video> outside Media, priority outside the hero, <Media> without
sizes, raw YouTube iframes, 100vh/h-screen, fixed pixel sizes, page JSON-LD,
upload sandbox headers, images preset, missing form seeds; accepts
createMarkdownRoute / createSubmitAction.
ipal-seo-check: exactly one h1, heading jumps, img alt and dimensions, LCP
priority, og:image, thin pages, internal links, X-Robots-Tag noindex left on
in production. Verified on bad and good fixtures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-16 03:22:55 +02:00
co-authored by Claude Opus 5.5
parent 69309b09e3
commit f52fbe6b12
2 changed files with 63 additions and 3 deletions
+26 -2
View File
@@ -114,6 +114,18 @@ if [ -n "$BLOCKS" ]; then
report ERROR "hardcoded text in blocks" "§2 every visible text comes from the panel (localized field)" \
"$(node "$(dirname "$0")/jsx-text.mjs" $BLOCKS 2>/dev/null)"
report WARNING "<video> outside <Media>" "§6.11b videoMode background|player via Media (videoProps)" \
"$(g '<video[ >]' $BLOCKS --include=*.tsx)"
report WARNING "priority outside the hero" "§6.11b exactly one LCP image per page — priority only in the first section" \
"$(g '<Media[^>]*\bpriority\b' $BLOCKS --include=*.tsx | grep -viE '/hero')"
report WARNING "<Media> without sizes" "§6.11b sizes = width on screen (MEDIA_SIZES.*) — without it the full-width file downloads" \
"$(g '<Media[^>]*/>' $BLOCKS --include=*.tsx | grep -v 'sizes=')"
report WARNING "raw YouTube iframe" "§6.11b <YouTubeEmbed> (iframe only after click, no cookies before)" \
"$(g '<iframe[^>]*youtube' src --include=*.tsx)"
report WARNING "inline <svg> in blocks" "§6.10 icons via media upload or Icon map" \
"$(g '<svg[ >]' $BLOCKS --include=*.tsx)"
@@ -130,6 +142,12 @@ if [ -d src/components ]; then
fi
if [ -n "$UI" ]; then
report WARNING "100vh / h-screen" "§6.11a use min-h-[var(--ipal-hero-min-h)] (svh, capped) — 100vh overflows on laptops and mobile bars" \
"$(g '\b(h-screen|min-h-screen|h-\[100vh\]|min-h-\[100vh\])' $UI --include=*.tsx)"
report WARNING "fixed pixel widths/heights" "§6.11a no w-[640px]/h-[500px] in sections — max-w-*, %, aspect-*, min()" \
"$(g '\b(w|h|min-w|min-h)-\[[0-9]{3,}px\]' $UI --include=*.tsx)"
report ERROR "hex colors in classes" "§6.11 use design tokens (bg-primary…)" \
"$(g '(bg|text|border|from|to|via|fill|stroke)-\[#' $UI --include=*.tsx)"
@@ -207,7 +225,8 @@ if [ -n "$APP" ]; then
# GEO
need ERROR llms "llms.txt" "src/app/llms.txt/route.ts → createLlmsTxtRoute" 'createLlmsTxtRoute|buildLlmsTxt' src/app
need ERROR llms-full "llms-full.txt" "src/app/llms-full.txt/route.ts → createLlmsTxtRoute({ full: true })" 'full: *true' src/app/llms-full.txt
need ERROR markdown "Markdown route" "src/app/md/[locale]/[[...slug]]/route.ts → createMarkdownRenderer + markdownResponse" 'createMarkdownRenderer' src/app
need ERROR markdown "Markdown route" "src/app/md/[locale]/[[...slug]]/route.ts → createMarkdownRoute" 'createMarkdownRoute|createMarkdownRenderer' src/app
need WARNING jsonld "page structured data" "[[...slug]]/page.tsx → <JsonLdGraph schemas={await getPageJsonLd(locale, slug)} />" 'getPageJsonLd|buildWebPageJsonLd|buildBreadcrumbJsonLd' src/app
need ERROR markdown "Markdown in proxy" "proxy.ts → createProxy(i18nConfig, { NextResponse, markdown: true }) — without it /md/… is redirected to /<locale>/md/…" 'markdown: *(true|['"'"'"])|prefersMarkdown' src/proxy.ts proxy.ts
need WARNING markdown "Markdown alternate link" "createContentHelpers({ markdownAlternate: true }) or markdownHref in metadata" 'markdownAlternate|markdownHref' src
need ERROR mcp "MCP server" "src/app/api/mcp/route.ts → createMcpRoute (public: AI browses the site)" 'createMcpRoute' src/app
@@ -223,7 +242,9 @@ if [ -n "$APP" ]; then
need WARNING turnstile "getTurnstileConfig" "siteKey from getTurnstileConfig(payload) — off unless BOTH keys are set" 'getTurnstileConfig' src
need WARNING '' "MediaPreconnect" "<MediaPreconnect/> in the layout (R2 CDN preconnect from env)" 'MediaPreconnect' src/app
# Forms
need ERROR '' "form submission via the plugin" "server action sendForm → submitForm (ipal-form)" 'submitForm' src
need ERROR '' "form submission via the plugin" "actions.ts → export const sendForm = createSubmitAction({ getCachedPayload, headers }) (ipal-form)" 'createSubmitAction|submitForm' src
need WARNING '' "upload sandbox headers" "next.config.ts → ...buildUploadSecurityHeaders() (uploaded SVG can't run script)" 'buildUploadSecurityHeaders' next.config.ts next.config.mjs next.config.js
need WARNING '' "images preset" "next.config.ts → images: { ...buildImagesConfig() } (AVIF/WebP, R2 domain)" 'buildImagesConfig' next.config.ts next.config.mjs next.config.js
fi
if [ -n "$CFG" ]; then
@@ -235,6 +256,9 @@ if [ -n "$CFG" ]; then
report WARNING "robots blocks AI bots" "§0b.8 — only with the client's decision in AGENTS.md" \
"$(skipped aibots || g "aiBots: *'(disallow|block-training)'" src --include=*.ts)"
fi
if [ -n "$CFG" ] && grep -qE 'forms *:' "$CFG" 2>/dev/null && ! ls scripts/seed-form* >/dev/null 2>&1 && ! skipped forms-seed; then
report WARNING "no form seed" "ipal-form §5 — every form from scripts/seed-form-*.ts (notification + sender confirmation, all languages)" "scripts/seed-form-*.ts"
fi
need WARNING r2 "R2 env in .env.example" ".env.example lists R2_BUCKET, R2_ENDPOINT, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_PUBLIC_URL" 'R2_BUCKET' .env.example
need WARNING '' "IPAL_IP_HEADER in .env.example" "header the rate limit trusts, e.g. cf-connecting-ip (forms.md)" 'IPAL_IP_HEADER' .env.example
@@ -98,7 +98,7 @@ for (let i = 0; sample.length < Math.min(MAX, urls.length); i++) {
const multiLocale = hasAlternates || byLocale.size > 1
const urlSet = new Set(urls.map(norm))
const titles = new Map()
const issues = { status: [], noHead: [], body: [], title: [], longTitle: [], desc: [], canonical: [], canonSelf: [], noindex: [], hreflang: [], xdefault: [], reciprocal: [], favicon: [], jsonLd: [], mdAlt: [] }
const issues = { status: [], noHead: [], body: [], title: [], longTitle: [], desc: [], canonical: [], canonSelf: [], noindex: [], hreflang: [], xdefault: [], reciprocal: [], favicon: [], jsonLd: [], mdAlt: [], h1: [], headingSkip: [], alt: [], imgSize: [], lcp: [], ogImage: [], thin: [], noLinks: [], xRobots: [] }
const checkedPaths = []
for (const url of sample) {
@@ -135,6 +135,33 @@ for (const url of sample) {
if (!/<link[^>]+type="text\/markdown"/i.test(head)) issues.mdAlt.push(url)
checkedPaths.push(new URL(url).pathname)
// --- content & performance (AGENT.md §0c, §6.11b) ---
if (/noindex/i.test(page.res.headers.get('x-robots-tag') ?? '')) issues.xRobots.push(url)
const main = body.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<template[\s\S]*?<\/template>/gi, '')
const h1s = (main.match(/<h1[\s>]/gi) ?? []).length
if (h1s !== 1) issues.h1.push(`${url} (${h1s} h1)`)
let prev = 0
for (const m of main.matchAll(/<h([1-6])[\s>]/gi)) {
const level = Number(m[1])
if (prev && level > prev + 1) { issues.headingSkip.push(`${url} (h${prev} → h${level})`); break }
prev = level
}
const imgs = tags(main, /<img\b[^>]*>/gi)
const noAlt = imgs.filter((t) => !/\salt\s*=/.test(t))
if (noAlt.length) issues.alt.push(`${url} (${noAlt.length} img)`)
const noSize = imgs.filter((t) => !/\swidth\s*=/.test(t) || !/\sheight\s*=/.test(t)).filter((t) => !/data-nimg="fill"/.test(t))
if (noSize.length) issues.imgSize.push(`${url} (${noSize.length} img)`)
if (imgs.length && !/fetchpriority="high"/i.test(imgs[0]) && !/<link[^>]+rel="preload"[^>]+as="image"/i.test(head)) issues.lcp.push(url)
if (!/<meta[^>]+property="og:image"/i.test(head)) issues.ogImage.push(url)
const words = main.replace(/<[^>]+>/g, ' ').replace(/&[a-z#0-9]+;/gi, ' ').split(/\s+/).filter((w) => /\p{L}{2,}/u.test(w)).length
if (words < 150) issues.thin.push(`${url} (${words} words)`)
const own = new URL(url).host
const internal = tags(main, /<a\b[^>]*href="([^"#]+)"[^>]*>/gi).filter((t) => {
const href = attr(t, 'href') ?? ''
try { const u = new URL(href, url); return u.host === own && norm(u.pathname) !== norm(new URL(url).pathname) } catch { return false }
})
if (internal.length === 0) issues.noLinks.push(url)
if (multiLocale) {
const alts = tags(head, /<link[^>]+hreflang="[^"]+"[^>]*>/gi).map((t) => ({ lang: attr(t, 'hreflang'), href: attr(t, 'href') }))
if (alts.length === 0) issues.hreflang.push(url)
@@ -161,6 +188,15 @@ if (issues.desc.length) report('WARNING', 'missing meta description', 'fill SEO
if (dupTitles.length) report('WARNING', 'duplicate titles', 'unique meta titles per page', dupTitles)
if (issues.longTitle.length) report('WARNING', 'titles over 65 chars (truncated in results)', 'shorten in the SEO tab', issues.longTitle)
if (issues.favicon.length) report('WARNING', 'no favicon link in head', 'buildIconsMetadata(settings.favicon) in root generateMetadata', issues.favicon.slice(0, 3))
if (issues.xRobots.length) report('ERROR', 'X-Robots-Tag: noindex on pages', 'IPAL_NOINDEX is set in this environment — remove it in production', issues.xRobots.slice(0, 3))
if (issues.h1.length) report('ERROR', 'not exactly one h1', 'one h1 per page — SectionHeader as="h1" only in the first section (AGENT.md §0c)', issues.h1)
if (issues.alt.length) report('ERROR', 'images without alt', 'alt from the Media document; decorative: alt=""', issues.alt)
if (issues.headingSkip.length) report('WARNING', 'heading levels skipped', 'h1 → h2 → h3, no jumps (AGENT.md §0c)', issues.headingSkip)
if (issues.imgSize.length) report('WARNING', 'images without width/height (layout shift)', '<Media> via mediaImageProps (AGENT.md §6.11b)', issues.imgSize)
if (issues.lcp.length) report('WARNING', 'first image not prioritised (LCP)', '<Media priority> on the hero image (AGENT.md §6.11b)', issues.lcp)
if (issues.ogImage.length) report('WARNING', 'no og:image', 'share image in the SEO tab or Site Settings → Default share image', issues.ogImage.slice(0, 5))
if (issues.thin.length) report('WARNING', 'thin pages (< 150 words)', 'add real content from the brief or merge pages (AGENT.md §0c)', issues.thin)
if (issues.noLinks.length) report('WARNING', 'pages without internal links', 'link related pages and contact (AGENT.md §0c)', issues.noLinks)
if (!skipped('jsonld') && issues.jsonLd.length) report('ERROR', 'no JSON-LD structured data', '<JsonLdGraph> WebSite + Organization in [locale]/layout.tsx (AGENT.md §0b.4)', issues.jsonLd.slice(0, 5))
if (!skipped('markdown') && issues.mdAlt.length) report('WARNING', 'no text/markdown alternate link in head', 'createContentHelpers({ markdownAlternate: true }) (AGENT.md §0b.6)', issues.mdAlt.slice(0, 3))