seo-supervisor 0.0.0-stage → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +14 -0
- package/CHANGELOG.md +31 -0
- package/LICENSE +25 -0
- package/README.md +197 -2
- package/bin/agents.mjs +65 -0
- package/bin/prompt.mjs +76 -0
- package/bin/seo-supervisor.mjs +144 -0
- package/commands/seo-audit.md +7 -0
- package/commands/seo-fix.md +13 -0
- package/commands/seo-launch.md +7 -0
- package/commands/seo-review.md +7 -0
- package/commands/seo-setup.md +19 -0
- package/package.json +45 -4
- package/skills/seo-supervisor/SKILL.md +199 -0
- package/skills/seo-supervisor/examples/sample-audit.json +440 -0
- package/skills/seo-supervisor/examples/sample-report.html +654 -0
- package/skills/seo-supervisor/examples/sample-report.md +257 -0
- package/skills/seo-supervisor/examples/security-tools-profile.md +73 -0
- package/skills/seo-supervisor/examples/snippets.md +134 -0
- package/skills/seo-supervisor/frameworks/nextjs.md +98 -0
- package/skills/seo-supervisor/frameworks/rails.md +34 -0
- package/skills/seo-supervisor/frameworks/spa.md +14 -0
- package/skills/seo-supervisor/planning.md +145 -0
- package/skills/seo-supervisor/profile-template.md +55 -0
- package/skills/seo-supervisor/report-format.md +146 -0
- package/skills/seo-supervisor/rules/ai-search.md +40 -0
- package/skills/seo-supervisor/rules/content.md +60 -0
- package/skills/seo-supervisor/rules/crawl-index.md +65 -0
- package/skills/seo-supervisor/rules/internal-linking.md +61 -0
- package/skills/seo-supervisor/rules/launch-monitoring.md +48 -0
- package/skills/seo-supervisor/rules/media.md +30 -0
- package/skills/seo-supervisor/rules/metadata.md +39 -0
- package/skills/seo-supervisor/rules/performance.md +33 -0
- package/skills/seo-supervisor/rules/rendering.md +42 -0
- package/skills/seo-supervisor/rules/sitemaps-robots.md +37 -0
- package/skills/seo-supervisor/rules/structured-data.md +75 -0
- package/skills/seo-supervisor/rules/trust-security.md +25 -0
- package/skills/seo-supervisor/rules/urls.md +46 -0
- package/skills/seo-supervisor/scripts/content-scan.mjs +173 -0
- package/skills/seo-supervisor/scripts/fonts/OFL-BricolageGrotesque.txt +93 -0
- package/skills/seo-supervisor/scripts/fonts/OFL-Geist.txt +93 -0
- package/skills/seo-supervisor/scripts/fonts/OFL-GeistMono.txt +93 -0
- package/skills/seo-supervisor/scripts/fonts/bricolage-grotesque.woff2 +0 -0
- package/skills/seo-supervisor/scripts/fonts/geist-mono.woff2 +0 -0
- package/skills/seo-supervisor/scripts/fonts/geist.woff2 +0 -0
- package/skills/seo-supervisor/scripts/render-report.mjs +706 -0
- package/skills/seo-supervisor/scripts/report-plan.mjs +162 -0
- package/skills/seo-supervisor/scripts/seo-crawl.mjs +703 -0
- package/skills/seo-supervisor/site-types/content.md +22 -0
- package/skills/seo-supervisor/site-types/ecommerce.md +27 -0
- package/skills/seo-supervisor/site-types/local-business.md +28 -0
- package/skills/seo-supervisor/site-types/services.md +22 -0
- package/skills/seo-supervisor/site-types/tools.md +127 -0
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// render-report.mjs: turns an audit JSON (or raw seo-crawl / content-scan output) into
|
|
3
|
+
// seo-audit.html – the overview: score, area scores, charts, then tabs for the detail
|
|
4
|
+
// seo-audit.md – every finding in full, all evidence, for reading, diffing and pasting
|
|
5
|
+
//
|
|
6
|
+
// node render-report.mjs seo-audit/seo-audit.json [--out seo-audit/seo-audit.html] [--md seo-audit/seo-audit.md] [--no-md]
|
|
7
|
+
//
|
|
8
|
+
// One self-contained HTML file: no network requests, no dependencies, light + dark, phone, print.
|
|
9
|
+
// The JSON shape and the score model are documented in ../report-format.md.
|
|
10
|
+
|
|
11
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
12
|
+
import { dirname, resolve, basename } from "node:path";
|
|
13
|
+
import { planStats, planHtml, planMarkdown, PLAN_CSS } from "./report-plan.mjs";
|
|
14
|
+
|
|
15
|
+
const argv = process.argv.slice(2);
|
|
16
|
+
const inPath = argv.find(a => !a.startsWith("--"));
|
|
17
|
+
if (!inPath) { console.error("Usage: node render-report.mjs <audit.json|seo-crawl.json|content-scan.json> [--out report.html] [--md report.md] [--no-md]"); process.exit(2); }
|
|
18
|
+
const opt = k => { const i = argv.indexOf(k); return i >= 0 ? argv[i + 1] : null; };
|
|
19
|
+
const outPath = resolve(opt("--out") || inPath.replace(/\.json$/i, "") + ".html");
|
|
20
|
+
const mdPath = argv.includes("--no-md") ? null : resolve(opt("--md") || outPath.replace(/\.html?$/i, "") + ".md");
|
|
21
|
+
const raw = JSON.parse(readFileSync(inPath, "utf8"));
|
|
22
|
+
|
|
23
|
+
// ---------- fonts: bundled woff2 (SIL OFL), inlined so the report stays a single offline file ----------
|
|
24
|
+
const FONTS = [
|
|
25
|
+
["Geist", "geist.woff2", "100 900"],
|
|
26
|
+
["Geist Mono", "geist-mono.woff2", "100 900"],
|
|
27
|
+
["Bricolage Grotesque", "bricolage-grotesque.woff2", "200 800"],
|
|
28
|
+
];
|
|
29
|
+
const FONT_FACES = FONTS.map(([family, file, weight]) => {
|
|
30
|
+
const path = new URL("./fonts/" + file, import.meta.url);
|
|
31
|
+
if (!existsSync(path)) return "";
|
|
32
|
+
return `@font-face{font-family:"${family}";src:url(data:font/woff2;base64,${readFileSync(path).toString("base64")}) format("woff2");font-weight:${weight};font-style:normal;font-display:swap}`;
|
|
33
|
+
}).join("\n");
|
|
34
|
+
|
|
35
|
+
// ---------- normalise ----------
|
|
36
|
+
const isCrawl = raw.tool === "seo-supervisor-crawler";
|
|
37
|
+
const isScan = raw.tool === "seo-supervisor-content-scan";
|
|
38
|
+
const site = raw.site || { name: isCrawl ? new URL(raw.siteOrigin).host : isScan ? `Content: ${basename(String(raw.source))}` : "Website", url: raw.siteOrigin || "" };
|
|
39
|
+
const run = { ...(raw.run || {}) };
|
|
40
|
+
if (isCrawl) Object.assign(run, { mode: "crawl", date: raw.crawledAt, pagesCrawled: raw.stats?.htmlPages, auditor: "seo-crawl.mjs " + raw.version });
|
|
41
|
+
if (isScan) Object.assign(run, { mode: "content scan", date: raw.scannedAt, auditor: "content-scan.mjs" });
|
|
42
|
+
const SEV = ["blocker", "high", "needs-decision", "medium", "low"];
|
|
43
|
+
const SEV_LABEL = { blocker: "Blocker", high: "High", "needs-decision": "Decision", medium: "Medium", low: "Low" };
|
|
44
|
+
const STATUS_LABEL = { open: "Open", fixed: "Fixed", "wont-fix": "Won't fix", "needs-decision": "Needs decision", "in-progress": "In progress" };
|
|
45
|
+
const findings = (raw.findings || []).map((f, i) => ({ evidence: [], ...f, id: f.id || `F-${String(i + 1).padStart(3, "0")}`, severity: SEV.includes(f.severity) ? f.severity : "low", status: f.status || (f.severity === "needs-decision" ? "needs-decision" : "open"), category: f.category || "Other" }));
|
|
46
|
+
const isOpen = f => f.status !== "fixed";
|
|
47
|
+
findings.sort((a, b) => (!isOpen(a)) - (!isOpen(b)) || SEV.indexOf(a.severity) - SEV.indexOf(b.severity) || (b.count || 0) - (a.count || 0));
|
|
48
|
+
const passed = raw.passed || [];
|
|
49
|
+
const notChecked = raw.notChecked || [];
|
|
50
|
+
const notes = raw.notes || [];
|
|
51
|
+
const decisions = [
|
|
52
|
+
...(raw.decisions || []).map(d => ({ ...d })),
|
|
53
|
+
...findings.filter(f => f.status === "needs-decision" && isOpen(f)).map(f => ({ id: f.id, question: f.decision?.question || f.title, context: f.what || f.why, options: f.decision?.options, recommendation: f.decision?.recommendation || f.fix })),
|
|
54
|
+
];
|
|
55
|
+
const open = findings.filter(isOpen), fixed = findings.filter(f => !isOpen(f));
|
|
56
|
+
const countSev = s => open.filter(f => f.severity === s).length;
|
|
57
|
+
|
|
58
|
+
// ---------- score model (documented in report-format.md) ----------
|
|
59
|
+
// Every checked rule is worth 10 points. A passing rule (or one whose findings are all fixed) earns 10;
|
|
60
|
+
// a rule with open findings earns by its worst one: low 8, medium 6, decision 6, high 3, blocker 0.
|
|
61
|
+
// Score = earned / possible. Open blockers cap it: 1 → 59, 2 → 49, 3 → 39 … (never below 9).
|
|
62
|
+
const EARN = { blocker: 0, high: 3, "needs-decision": 6, medium: 6, low: 8 };
|
|
63
|
+
// fixedCountsAsOpen: the score before this run's fixes. assume: findings to treat as fixed (the "once blockers are fixed" score).
|
|
64
|
+
function buildRules({ fixedCountsAsOpen = false, assume = () => false } = {}) {
|
|
65
|
+
const rules = new Map();
|
|
66
|
+
for (const f of findings) {
|
|
67
|
+
const key = f.rule || f.id;
|
|
68
|
+
const r = rules.get(key) || { key, area: f.category, worst: null };
|
|
69
|
+
if (!assume(f) && (fixedCountsAsOpen || isOpen(f)) && (r.worst === null || SEV.indexOf(f.severity) < SEV.indexOf(r.worst))) r.worst = f.severity;
|
|
70
|
+
rules.set(key, r);
|
|
71
|
+
}
|
|
72
|
+
for (const p of passed) if (!rules.has(p.rule)) rules.set(p.rule, { key: p.rule, area: p.category || "Other", worst: null });
|
|
73
|
+
return [...rules.values()];
|
|
74
|
+
}
|
|
75
|
+
function score(rules) {
|
|
76
|
+
if (!rules.length) return null;
|
|
77
|
+
const earned = rules.reduce((s, r) => s + (r.worst ? EARN[r.worst] : 10), 0);
|
|
78
|
+
const rawScore = Math.round((100 * earned) / (rules.length * 10));
|
|
79
|
+
const blockers = rules.filter(r => r.worst === "blocker").length;
|
|
80
|
+
const cap = blockers ? Math.max(9, 69 - 10 * blockers) : 100;
|
|
81
|
+
return { value: Math.min(rawScore, cap), raw: rawScore, cap: blockers ? cap : null, blockers, rules: rules.length, passing: rules.filter(r => !r.worst).length };
|
|
82
|
+
}
|
|
83
|
+
const BANDS = [[90, "Excellent", "b5"], [75, "Good", "b4"], [60, "Fair", "b3"], [40, "Poor", "b2"], [0, "Critical", "b1"]];
|
|
84
|
+
const bandOf = v => BANDS.find(([min]) => v >= min);
|
|
85
|
+
const rules = buildRules();
|
|
86
|
+
const overall = score(rules);
|
|
87
|
+
const areaNames = [...new Set(rules.map(r => r.area))];
|
|
88
|
+
const areas = areaNames.map(name => {
|
|
89
|
+
const s = score(rules.filter(r => r.area === name));
|
|
90
|
+
const top = open.filter(f => f.category === name);
|
|
91
|
+
const fixedHere = fixed.filter(f => f.category === name).length;
|
|
92
|
+
return { name, ...s, worst: top[0]?.severity || null, top, fixedHere };
|
|
93
|
+
}).sort((a, b) => a.value - b.value || a.name.localeCompare(b.name));
|
|
94
|
+
|
|
95
|
+
const before = fixed.length ? score(buildRules({ fixedCountsAsOpen: true })) : null;
|
|
96
|
+
// While blockers cap the score, show what fixing them unlocks, and who has to do it (fixBy: "owner").
|
|
97
|
+
const isBlocker = f => f.severity === "blocker";
|
|
98
|
+
const openBlockers = findings.filter(f => isBlocker(f) && isOpen(f));
|
|
99
|
+
const unlock = overall?.cap ? score(buildRules({ assume: isBlocker })) : null;
|
|
100
|
+
const beforeUnlock = unlock && before ? score(buildRules({ fixedCountsAsOpen: true, assume: isBlocker })) : null;
|
|
101
|
+
const needsYou = f => f.fixBy === "owner" && isOpen(f);
|
|
102
|
+
// What this run's fixes changed. When the blocker cap holds the total still, show the checked-rules gain instead.
|
|
103
|
+
// (a function, so it runs after plural() below is defined)
|
|
104
|
+
function deltaOf() {
|
|
105
|
+
if (!before || !overall) return null;
|
|
106
|
+
const fx = plural(fixed.length, "fix", "fixes");
|
|
107
|
+
if (before.value !== overall.value) {
|
|
108
|
+
const up = overall.value > before.value;
|
|
109
|
+
return { dir: up ? "up" : "down", html: `${up ? "Up" : "Down"} <b>${Math.abs(overall.value - before.value)}</b> from ${before.value} before this run's ${fx}` };
|
|
110
|
+
}
|
|
111
|
+
if (unlock && beforeUnlock && beforeUnlock.value !== unlock.value) {
|
|
112
|
+
const up = unlock.value > beforeUnlock.value;
|
|
113
|
+
const n = Math.abs(unlock.value - beforeUnlock.value);
|
|
114
|
+
return { dir: up ? "up" : "down", inUnlock: true, html: up ? `The ${fx} from this run earned <b>${n}</b> ${n === 1 ? "point" : "points"}. You'll see ${n === 1 ? "it" : "them"} once the ${openBlockers.length === 1 ? "blocker is" : "blockers are"} fixed` : `This run's changes cost <b>${n}</b> ${n === 1 ? "point" : "points"}` };
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const impact = (() => {
|
|
119
|
+
if (!overall) return { rows: [], cap: 0 };
|
|
120
|
+
const possible = overall.rules * 10;
|
|
121
|
+
const lost = areas.map(a => ({ a, exact: (100 * rules.filter(r => r.area === a.name).reduce((s, r) => s + (r.worst ? 10 - EARN[r.worst] : 0), 0)) / possible }));
|
|
122
|
+
const target = 100 - overall.raw;
|
|
123
|
+
lost.forEach(x => { x.pts = Math.floor(x.exact); });
|
|
124
|
+
let rest = target - lost.reduce((s, x) => s + x.pts, 0);
|
|
125
|
+
[...lost].sort((x, y) => (y.exact - y.pts) - (x.exact - x.pts)).forEach(x => { if (rest > 0 && x.exact > x.pts) { x.pts++; rest--; } });
|
|
126
|
+
return { rows: lost.filter(x => x.exact > 0).sort((x, y) => y.exact - x.exact || x.a.value - y.a.value), cap: overall.raw - overall.value };
|
|
127
|
+
})();
|
|
128
|
+
|
|
129
|
+
let verdict;
|
|
130
|
+
if (!overall) verdict = "Not scored: no checked rules in this file.";
|
|
131
|
+
else if (countSev("blocker")) verdict = `Not ready: ${countSev("blocker")} blocker${countSev("blocker") > 1 ? "s" : ""} to fix first`;
|
|
132
|
+
else if (countSev("high")) verdict = `Needs work: ${countSev("high")} high-severity issue${countSev("high") > 1 ? "s" : ""}`;
|
|
133
|
+
else if (open.length) verdict = "In good shape: only minor issues left";
|
|
134
|
+
else verdict = "Every checked rule passes";
|
|
135
|
+
|
|
136
|
+
// ---------- helpers ----------
|
|
137
|
+
const esc = s => String(s ?? "").replace(/[&<>"']/g, c => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]));
|
|
138
|
+
const inl = s => esc(s).replace(/`([^`]+)`/g, "<code>$1</code>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
|
|
139
|
+
const fmtDate = d => { const x = new Date(d || Date.now()); return isNaN(x) ? String(d) : x.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }); };
|
|
140
|
+
const num = n => Number(n).toLocaleString("en-US");
|
|
141
|
+
const plural = (n, w, p = w + "s") => `${num(n)} ${n === 1 ? w : p}`;
|
|
142
|
+
const firstSentence = s => { const m = String(s || "").match(/^.*?[.!?](\s|$)/); return m ? m[0].trim() : String(s || ""); };
|
|
143
|
+
const ICON = {
|
|
144
|
+
chevron: '<svg class="chev" viewBox="0 0 16 16" aria-hidden="true"><path d="M5.5 3.5 10 8l-4.5 4.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
145
|
+
check: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="m3.5 8.5 3 3 6-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
146
|
+
arrow: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3 8h9.5M8.5 4l4 4-4 4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>',
|
|
147
|
+
search: '<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="4.5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="m10.5 10.5 3 3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>',
|
|
148
|
+
};
|
|
149
|
+
const dot = s => `<i class="dot d-${s}" aria-hidden="true"></i>`;
|
|
150
|
+
const mdFile = mdPath ? basename(mdPath) : null;
|
|
151
|
+
|
|
152
|
+
// ---------- overview ----------
|
|
153
|
+
function scoreScale(v) {
|
|
154
|
+
const segs = [[0, 40, "b1"], [40, 60, "b2"], [60, 75, "b3"], [75, 90, "b4"], [90, 100, "b5"]];
|
|
155
|
+
return `<div class="scale" role="img" aria-label="Score ${v} on a 0 to 100 scale: 0–39 critical, 40–59 poor, 60–74 fair, 75–89 good, 90–100 excellent">
|
|
156
|
+
<div class="track">${segs.map(([a, b, c]) => `<span class="${c}" style="flex:${b - a}"></span>`).join("")}</div>
|
|
157
|
+
<span class="marker" style="left:${v}%"><b>${v}</b></span>
|
|
158
|
+
<div class="ticks">${[0, 40, 60, 75, 90, 100].map(t => `<span style="left:${t}%">${t}</span>`).join("")}</div>
|
|
159
|
+
</div>`;
|
|
160
|
+
}
|
|
161
|
+
function unlockHtml(delta) {
|
|
162
|
+
if (!unlock) return "";
|
|
163
|
+
const [, name, cls] = bandOf(unlock.value);
|
|
164
|
+
const ids = list => list.map(f => `<a href="#${esc(f.id)}">${esc(f.id)}</a>`).join(", ");
|
|
165
|
+
const owner = openBlockers.filter(needsYou), agent = openBlockers.filter(f => !needsYou(f));
|
|
166
|
+
const who = [
|
|
167
|
+
owner.length && `${ids(owner)} need${owner.length === 1 ? "s" : ""} you: the agent won't change ${owner.length === 1 ? "it" : "them"} without your go-ahead.`,
|
|
168
|
+
agent.length && `${ids(agent)} can be fixed with <code>/seo-fix</code>.`,
|
|
169
|
+
].filter(Boolean).join(" ");
|
|
170
|
+
return `<div class="unlock">
|
|
171
|
+
<p class="u-k">Fix ${openBlockers.length === 1 ? "the blocker" : `the ${openBlockers.length} blockers`} and the score rises to</p>
|
|
172
|
+
<p class="u-v"><span class="from">${overall.value}</span><span class="arrow" aria-hidden="true">→</span><span class="to ${cls}-t">${unlock.value}</span><span class="chip ${cls}">${name}</span></p>
|
|
173
|
+
${delta && delta.inUnlock ? `<p class="u-s delta ${delta.dir}">${delta.html}.</p>` : ""}
|
|
174
|
+
${who ? `<p class="u-s">${who}</p>` : ""}
|
|
175
|
+
</div>`;
|
|
176
|
+
}
|
|
177
|
+
function overviewHtml() {
|
|
178
|
+
if (!overall) return `<section class="panel empty-state"><h2>Nothing to score</h2><p>This file has no findings or passed rules. Run the audit to fill it.</p></section>`;
|
|
179
|
+
const [, bandName, bandCls] = bandOf(overall.value);
|
|
180
|
+
const capLine = overall.cap ? `${plural(overall.blockers, "open blocker")} hold${overall.blockers === 1 ? "s" : ""} the score at ${overall.cap} until fixed.` : `${overall.passing} of ${overall.rules} checked rules pass in full.`;
|
|
181
|
+
const delta = deltaOf();
|
|
182
|
+
const sevBar = SEV.map(s => [s, countSev(s)]).filter(([, n]) => n);
|
|
183
|
+
const totalOpen = open.length;
|
|
184
|
+
const fixFirst = open.filter(f => ["blocker", "high", "needs-decision"].includes(f.severity)).slice(0, 5);
|
|
185
|
+
const fallbackFirst = fixFirst.length ? fixFirst : open.slice(0, 3);
|
|
186
|
+
return `
|
|
187
|
+
<div class="ov-top">
|
|
188
|
+
<div class="ov-left">
|
|
189
|
+
<section class="panel score-panel" aria-labelledby="h-score">
|
|
190
|
+
<h2 id="h-score">SEO health score</h2>
|
|
191
|
+
<p class="big ${bandCls}-t"><span class="n">${overall.value}</span><span class="of">/100</span></p>
|
|
192
|
+
<p class="band"><span class="chip ${bandCls}">${bandName}</span><span class="verdict">${esc(verdict)}</span></p>
|
|
193
|
+
${scoreScale(overall.value)}
|
|
194
|
+
<p class="cap">${esc(capLine)}</p>
|
|
195
|
+
${unlockHtml(delta)}
|
|
196
|
+
${delta && !delta.inUnlock ? `<p class="delta ${delta.dir}">${delta.html}</p>` : ""}
|
|
197
|
+
<details class="how"><summary>How this score works</summary>
|
|
198
|
+
<p>Every checked rule is worth 10 points. A rule that passes, or whose findings are all fixed, earns 10. A rule with open findings earns by its worst one: low 8, medium or decision 6, high 3, blocker 0. The score is the share of points earned. Each open blocker caps it: one at 59, two at 49, three at 39. While a blocker is open, the panel also shows the score you reach once it is fixed. Area scores use the same rules within each area.</p>
|
|
199
|
+
</details>
|
|
200
|
+
</section>
|
|
201
|
+
<section class="panel stats" aria-label="Issues, fixes and rules">
|
|
202
|
+
<div class="stat">
|
|
203
|
+
<h3>Open issues</h3>
|
|
204
|
+
<p class="stat-n"><span class="n">${totalOpen}</span>${totalOpen ? "" : " · nothing open"}</p>
|
|
205
|
+
${totalOpen ? `<div class="stack" role="img" aria-label="${sevBar.map(([sv, n]) => `${n} ${SEV_LABEL[sv]}`).join(", ")}">${sevBar.map(([sv, n]) => `<span class="s-${sv}" style="flex:${n}"></span>`).join("")}</div>
|
|
206
|
+
<ul class="legend">${sevBar.map(([sv, n]) => `<li>${dot(sv)}<span>${SEV_LABEL[sv]}</span><b>${n}</b></li>`).join("")}</ul>` : ""}
|
|
207
|
+
</div>
|
|
208
|
+
<div class="stat">
|
|
209
|
+
<h3>Fixed this run</h3>
|
|
210
|
+
<p class="stat-n"><span class="n">${fixed.length}</span> of ${findings.length}</p>
|
|
211
|
+
<div class="stack" role="img" aria-label="${fixed.length} fixed, ${open.length} still open"><span class="s-fixed" style="flex:${fixed.length || 0.0001}"></span><span class="s-rest" style="flex:${open.length || 0.0001}"></span></div>
|
|
212
|
+
<p class="quiet">${fixed.length ? `${num(open.length)} still open` : "Run /seo-fix to start"}</p>
|
|
213
|
+
</div>
|
|
214
|
+
<div class="stat">
|
|
215
|
+
<h3>Rules checked</h3>
|
|
216
|
+
<p class="stat-n"><span class="n">${overall.passing}</span> of ${overall.rules} pass</p>
|
|
217
|
+
<div class="stack" role="img" aria-label="${overall.passing} pass, ${overall.rules - overall.passing} with open findings"><span class="s-pass" style="flex:${overall.passing || 0.0001}"></span><span class="s-fail" style="flex:${overall.rules - overall.passing || 0.0001}"></span></div>
|
|
218
|
+
<p class="quiet"><span class="key k-fail" aria-hidden="true"></span>${num(overall.rules - overall.passing)} failing${notChecked.length ? ` · ${num(notChecked.length)} not checked` : ""}</p>
|
|
219
|
+
</div>
|
|
220
|
+
</section>
|
|
221
|
+
|
|
222
|
+
</div>
|
|
223
|
+
<div class="ov-right">
|
|
224
|
+
<section class="panel factors" aria-labelledby="h-factors">
|
|
225
|
+
<div class="ph"><h2 id="h-factors">What's moving your score</h2><span class="sub">Points lost, biggest first</span></div>
|
|
226
|
+
<ol class="area-list">${(() => {
|
|
227
|
+
const maxPts = Math.max(impact.cap, ...impact.rows.map(x => x.pts), 1);
|
|
228
|
+
const bar = pts => `<span class="meter" aria-hidden="true"><i style="width:${Math.max(4, (100 * pts) / maxPts)}%"></i></span>`;
|
|
229
|
+
const rows = [];
|
|
230
|
+
if (impact.cap > 0) rows.push(`<li><a class="area" href="#findings" data-sev="blocker">${dot("blocker")}
|
|
231
|
+
<span class="an"><b>Blocker cap</b><span class="reason">${plural(overall.blockers, "open blocker")} hold${overall.blockers === 1 ? "s" : ""} the score at ${overall.cap} until fixed</span></span>
|
|
232
|
+
${bar(impact.cap)}<span class="as">−${impact.cap}<small>pts</small></span></a></li>`);
|
|
233
|
+
for (const { a, pts } of impact.rows) {
|
|
234
|
+
const line = a.top.length ? `${inl(a.top[0].title)}${a.top.length > 1 ? ` <span class="more">+${a.top.length - 1} more</span>` : ""}` : "All checks pass";
|
|
235
|
+
rows.push(`<li><a class="area" href="#findings" data-area="${esc(a.name)}">${a.worst ? dot(a.worst) : `<i class="dot d-pass" aria-hidden="true"></i>`}
|
|
236
|
+
<span class="an"><b>${esc(a.name)} <span class="ascore">${a.value}/100</span></b><span>${line}</span></span>
|
|
237
|
+
${bar(pts)}<span class="as">${pts ? `−${pts}` : "<1"}<small>pts</small></span></a></li>`);
|
|
238
|
+
}
|
|
239
|
+
const full = areas.filter(a => a.value === 100);
|
|
240
|
+
if (full.length) {
|
|
241
|
+
const fx = full.reduce((t, a) => t + a.fixedHere, 0);
|
|
242
|
+
rows.push(`<li><a class="area" href="#passed"><i class="dot d-pass" aria-hidden="true"></i>
|
|
243
|
+
<span class="an"><b>${plural(full.length, "area")} pass in full</b><span>${esc(full.map(a => a.name).join(", "))}${fx ? ` · ${fx} fixed this run` : ""}</span></span>
|
|
244
|
+
<span class="meter" aria-hidden="true"></span><span class="as ok">0<small>pts</small></span></a></li>`);
|
|
245
|
+
}
|
|
246
|
+
return rows.join("");
|
|
247
|
+
})()}</ol>
|
|
248
|
+
</section>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
${fallbackFirst.length ? `<section class="panel fixfirst" aria-labelledby="h-first">
|
|
252
|
+
<div class="ph"><h2 id="h-first">Fix first</h2><a class="link" href="#findings">All findings ${ICON.arrow}</a></div>
|
|
253
|
+
<ol>${fallbackFirst.map(f => `<li><a href="#${esc(f.id)}">${dot(f.severity)}<span class="sev-t">${SEV_LABEL[f.severity]}</span><span class="t">${inl(f.title)}${needsYou(f) ? ` <span class="own">Needs you</span>` : ""}</span><span class="c">${esc(f.category)}</span>${ICON.arrow}</a></li>`).join("")}</ol>
|
|
254
|
+
</section>` : ""}
|
|
255
|
+
`;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// ---------- findings ----------
|
|
259
|
+
function evidenceHtml(f) {
|
|
260
|
+
const ev = f.evidence || [];
|
|
261
|
+
if (!ev.length) return "";
|
|
262
|
+
const shown = ev.slice(0, 10);
|
|
263
|
+
const listedRest = ev.length - shown.length;
|
|
264
|
+
const total = Math.max(f.count || 0, ev.length);
|
|
265
|
+
const notes = [];
|
|
266
|
+
if (listedRest > 0) notes.push(`${num(listedRest)} more ${listedRest === 1 ? "example" : "examples"}${mdFile ? ` in <code>${esc(mdFile)}</code>` : ""}`);
|
|
267
|
+
if (total > ev.length) notes.push(`${num(total)} cases found in total; these are examples`);
|
|
268
|
+
return `<div class="ev"><h4>Evidence</h4><div class="tablewrap"><table><thead><tr><th scope="col">Where</th><th scope="col">Detail</th></tr></thead><tbody>${shown.map(e => `<tr><td>${e.url ? `<a href="${esc(e.url)}" rel="noopener">${esc(e.url)}</a>` : ""}${e.file ? `${e.url ? "<br>" : ""}<code>${esc(e.file)}${e.line ? ":" + esc(e.line) : ""}</code>` : ""}</td><td>${inl(e.detail || "")}</td></tr>`).join("")}</tbody></table></div>${notes.length ? `<p class="quiet">${notes.join(". ")}.</p>` : ""}</div>`;
|
|
269
|
+
}
|
|
270
|
+
function findingHtml(f) {
|
|
271
|
+
const isFixed = !isOpen(f);
|
|
272
|
+
return `<article class="f ${isFixed ? "is-fixed" : ""}" id="${esc(f.id)}" data-sev="${f.severity}" data-status="${esc(f.status)}" data-area="${esc(f.category)}" data-text="${esc([f.id, f.rule, f.title, f.what, f.category].join(" ").toLowerCase())}">
|
|
273
|
+
<h3><button class="f-head" aria-expanded="false" aria-controls="${esc(f.id)}-b">
|
|
274
|
+
${dot(f.severity)}
|
|
275
|
+
<span class="f-title">${inl(f.title)}</span>
|
|
276
|
+
<span class="f-meta"><span class="sev-t">${SEV_LABEL[f.severity]}</span>${needsYou(f) ? `<span class="own">Needs you</span>` : ""}<span>${esc(f.category)}</span>${f.rule ? `<span class="mono">${esc(f.rule)}</span>` : ""}${f.count > 1 ? `<span class="mono">${num(f.count)}×</span>` : ""}</span>
|
|
277
|
+
${isFixed ? `<span class="stamp">${ICON.check}Fixed</span>` : `<span class="st st-${esc(f.status)}">${esc(STATUS_LABEL[f.status] || f.status)}</span>`}
|
|
278
|
+
${ICON.chevron}
|
|
279
|
+
</button></h3>
|
|
280
|
+
<div class="f-body" id="${esc(f.id)}-b" role="region" aria-label="${esc(f.title)}">
|
|
281
|
+
<div class="f-cols">
|
|
282
|
+
<div>
|
|
283
|
+
${f.what ? `<h4>What's wrong</h4><p>${inl(f.what)}</p>` : ""}
|
|
284
|
+
${f.why ? `<h4>Why it matters</h4><p>${inl(f.why)}</p>` : ""}
|
|
285
|
+
</div>
|
|
286
|
+
<div>
|
|
287
|
+
${f.fix ? `<div class="howfix"><h4>How to fix</h4><p>${inl(f.fix)}</p></div>` : ""}
|
|
288
|
+
${f.decision ? `<div class="dec-inline"><h4>Decision needed</h4><p>${inl(f.decision.question || "")}</p>${(f.decision.options || []).length ? `<ul>${f.decision.options.map(o => `<li>${inl(o)}</li>`).join("")}</ul>` : ""}${f.decision.recommendation ? `<p><strong>Recommended:</strong> ${inl(f.decision.recommendation)}</p>` : ""}</div>` : ""}
|
|
289
|
+
${isFixed && f.fixed ? `<div class="donebox"><h4>What was done</h4><p>${inl(f.fixed.summary || "")}</p>${(f.fixed.files || []).length ? `<p class="files">${f.fixed.files.map(x => `<code>${esc(x)}</code>`).join(" ")}</p>` : ""}${f.fixed.verified ? `<p class="quiet">${ICON.check} ${inl(f.fixed.verified)}</p>` : ""}</div>` : ""}
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
${evidenceHtml(f)}
|
|
293
|
+
</div>
|
|
294
|
+
</article>`;
|
|
295
|
+
}
|
|
296
|
+
function findingsHtml() {
|
|
297
|
+
if (!findings.length) return `<section class="panel empty-state"><h2>No findings</h2><p>Every checked rule passed. See Passed for what was checked and Limits for what wasn't.</p></section>`;
|
|
298
|
+
const sevPresent = SEV.filter(s => findings.some(f => f.severity === s));
|
|
299
|
+
const areasPresent = [...new Set(findings.map(f => f.category))].sort();
|
|
300
|
+
const statuses = [...new Set(findings.map(f => f.status))];
|
|
301
|
+
return `<div class="toolbar" role="group" aria-label="Filter findings">
|
|
302
|
+
<label class="search">${ICON.search}<span class="sr">Search findings</span><input type="search" id="q" placeholder="Search title, rule or ID" autocomplete="off"></label>
|
|
303
|
+
<div class="seg" role="group" aria-label="Severity"><button type="button" class="segb" data-sev="all" aria-pressed="true">All</button>${sevPresent.map(s => `<button type="button" class="segb" data-sev="${s}" aria-pressed="false">${dot(s)}${SEV_LABEL[s]}<span class="mono">${findings.filter(f => f.severity === s).length}</span></button>`).join("")}</div>
|
|
304
|
+
<label class="sel"><span class="sr">Status</span><select id="fstatus"><option value="all">Any status</option>${statuses.map(s => `<option value="${esc(s)}">${esc(STATUS_LABEL[s] || s)}</option>`).join("")}</select></label>
|
|
305
|
+
<label class="sel"><span class="sr">Area</span><select id="farea"><option value="all">All areas</option>${areasPresent.map(a => `<option value="${esc(a)}">${esc(a)}</option>`).join("")}</select></label>
|
|
306
|
+
<p class="showing" id="showing" aria-live="polite">${findings.length} findings</p>
|
|
307
|
+
</div>
|
|
308
|
+
<div class="flist" id="flist">${findings.map(findingHtml).join("")}</div>
|
|
309
|
+
<p class="empty" id="fnone" hidden>No findings match these filters. <button type="button" class="link" id="freset">Clear filters</button></p>`;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// ---------- other tabs ----------
|
|
313
|
+
const decisionsHtml = () => decisions.length ? `<div class="cards">${decisions.map(d => `<article class="panel dcard">
|
|
314
|
+
${d.id ? `<a class="mono idlink" href="#${esc(d.id)}">${esc(d.id)}</a>` : ""}
|
|
315
|
+
<h3>${inl(d.question)}</h3>${d.context ? `<p>${inl(d.context)}</p>` : ""}
|
|
316
|
+
${(d.options || []).length ? `<ul class="opts">${d.options.map(o => `<li>${inl(o)}</li>`).join("")}</ul>` : ""}
|
|
317
|
+
${d.recommendation ? `<p class="rec"><strong>Recommended</strong> ${inl(d.recommendation)}</p>` : ""}
|
|
318
|
+
</article>`).join("")}</div>` : `<section class="panel empty-state"><h2>No decisions needed</h2><p>Nothing in this audit needs an owner's call.</p></section>`;
|
|
319
|
+
const changesHtml = () => fixed.length ? `<ol class="changes">${fixed.map(f => `<li class="panel">
|
|
320
|
+
<span class="stamp">${ICON.check}Fixed</span>
|
|
321
|
+
<div><h3><a href="#${esc(f.id)}">${inl(f.title)}</a></h3>
|
|
322
|
+
${f.fixed?.summary ? `<p>${inl(f.fixed.summary)}</p>` : ""}
|
|
323
|
+
${(f.fixed?.files || []).length ? `<p class="files">${f.fixed.files.map(x => `<code>${esc(x)}</code>`).join(" ")}</p>` : ""}
|
|
324
|
+
${f.fixed?.verified ? `<p class="quiet">${ICON.check} ${inl(f.fixed.verified)}</p>` : ""}</div>
|
|
325
|
+
<span class="mono quiet">${esc(f.id)}</span>
|
|
326
|
+
</li>`).join("")}</ol>` : `<section class="panel empty-state"><h2>No changes yet</h2><p>Run <code>/seo-fix</code> to fix findings. Each fix is re-checked and listed here with the files it touched.</p></section>`;
|
|
327
|
+
function passedHtml() {
|
|
328
|
+
const fixedRules = fixed.map(f => ({ rule: f.rule || f.id, title: f.title, category: f.category, detail: "fixed this run" }));
|
|
329
|
+
const all = [...passed, ...fixedRules.filter(x => !passed.some(p => p.rule === x.rule))];
|
|
330
|
+
if (!all.length) return `<section class="panel empty-state"><h2>No passed rules recorded</h2><p>This file lists findings only.</p></section>`;
|
|
331
|
+
const groups = all.reduce((m, p) => ((m[p.category || "Other"] ||= []).push(p), m), {});
|
|
332
|
+
return `<div class="pgrid">${Object.entries(groups).sort((a, b) => a[0].localeCompare(b[0])).map(([c, ps]) => `<section class="panel pgroup"><h3>${esc(c)}<span class="mono quiet">${ps.length}</span></h3><ul>${ps.map(p => `<li>${ICON.check}<span><span class="mono quiet">${esc(p.rule)}</span> ${inl(p.title)}${p.detail ? `<span class="quiet"> · ${inl(p.detail)}</span>` : ""}</span></li>`).join("")}</ul></section>`).join("")}</div>`;
|
|
333
|
+
}
|
|
334
|
+
const limitsHtml = () => (notChecked.length || notes.length) ? `<div class="limits">
|
|
335
|
+
${notChecked.length ? `<section class="panel"><h2>Not checked</h2><p class="quiet">These couldn't be verified in this run, so they count neither for nor against the score.</p><ul class="lim">${notChecked.map(n => `<li><b>${inl(n.area || n.rule || "")}</b><span>${inl(n.reason || "")}</span></li>`).join("")}</ul></section>` : ""}
|
|
336
|
+
${notes.length ? `<section class="panel"><h2>Notes from the audit</h2><ul class="lim">${notes.map(n => `<li><span>${inl(n)}</span></li>`).join("")}</ul></section>` : ""}
|
|
337
|
+
</div>` : `<section class="panel empty-state"><h2>No limits recorded</h2><p>Every planned check ran.</p></section>`;
|
|
338
|
+
|
|
339
|
+
// ---------- page ----------
|
|
340
|
+
const plan = raw.plan && typeof raw.plan === "object" ? raw.plan : null;
|
|
341
|
+
const tabs = [
|
|
342
|
+
["overview", "Overview", null],
|
|
343
|
+
["findings", "Findings", findings.length],
|
|
344
|
+
["decisions", "Decisions", decisions.length],
|
|
345
|
+
["changes", "Changes", fixed.length],
|
|
346
|
+
["passed", "Passed", passed.length + fixed.length],
|
|
347
|
+
["limits", "Limits", notChecked.length],
|
|
348
|
+
];
|
|
349
|
+
if (plan) tabs.splice(plan.status === "proposed" ? 0 : 1, 0, ["plan", "Plan", planStats(plan).rows]);
|
|
350
|
+
const DEFAULT_TAB = tabs[0][0];
|
|
351
|
+
const PANELS = { overview: overviewHtml, plan: () => planHtml(plan, { esc, inl, num }), findings: findingsHtml, decisions: decisionsHtml, changes: changesHtml, passed: passedHtml, limits: limitsHtml };
|
|
352
|
+
const metaBits = [site.url && `<a href="${esc(site.url)}" rel="noopener">${esc(site.url.replace(/^https?:\/\//, ""))}</a>`, run.pagesCrawled != null && `${num(run.pagesCrawled)} pages crawled`, esc(fmtDate(run.date)), run.mode === "fix" && "Includes fixes"].filter(Boolean);
|
|
353
|
+
|
|
354
|
+
const CSS = `
|
|
355
|
+
:root{--bg:#f4f6f9;--panel:#fff;--ink:#1c2a39;--ink2:#3a4757;--mute:#5d6878;--line:#e2e6ec;--line2:#cfd6df;--blue:#2459c9;--blue-soft:#e9effc;--sel:#cfe0ff;
|
|
356
|
+
--b1:#d64040;--b2:#e9772e;--b3:#e3a21a;--b4:#6fb35a;--b5:#238a52;
|
|
357
|
+
--blocker:#c93636;--high:#e0702b;--decision:#7b52c7;--medium:#d99a12;--low:#7d8a9c;--pass:#238a52;--fixed:#238a52;
|
|
358
|
+
--ok-soft:#e6f4ec;--warn-soft:#fdf3dc;--dec-soft:#f0eafb;
|
|
359
|
+
--b1-ink:#c03030;--b2-ink:#b5541a;--b5-ink:#1d7444;--chip-ink:#fff;
|
|
360
|
+
--display:"Bricolage Grotesque","Geist",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;--sans:"Geist",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;--mono:"Geist Mono",ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace;
|
|
361
|
+
--r:10px;--shadow:none;--neutral:#8a95a5;color-scheme:light}
|
|
362
|
+
@media screen{:root:not([data-theme="light"]){--bg:#0e131a;--panel:#151c26;--ink:#e6ebf2;--ink2:#c3ccd8;--mute:#98a3b3;--line:#232c39;--line2:#323d4d;--blue:#7ea2ff;--blue-soft:#1b2640;--sel:#2a3d66;
|
|
363
|
+
--b1:#ef6464;--b2:#f38b4a;--b3:#efb93b;--b4:#86c873;--b5:#45b97a;--blocker:#ef6464;--high:#f38b4a;--decision:#a587ec;--medium:#efb93b;--low:#8c99ab;--pass:#45b97a;--fixed:#45b97a;
|
|
364
|
+
--ok-soft:#14291e;--warn-soft:#2c2412;--dec-soft:#231c38;--neutral:#6b7788;--b1-ink:#ef6464;--b2-ink:#f38b4a;--b5-ink:#45b97a;--chip-ink:#0e131a;--shadow:0 1px 2px rgba(0,0,0,.3),0 6px 18px rgba(0,0,0,.25);color-scheme:dark}}
|
|
365
|
+
*{box-sizing:border-box}
|
|
366
|
+
html{scrollbar-color:var(--line2) transparent;-webkit-text-size-adjust:100%}
|
|
367
|
+
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.55 var(--sans);font-variant-numeric:tabular-nums;caret-color:var(--blue)}
|
|
368
|
+
::selection{background:var(--sel)}
|
|
369
|
+
a{color:var(--blue);text-underline-offset:3px;text-decoration-thickness:1px}
|
|
370
|
+
:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:6px}
|
|
371
|
+
h1,h2,h3,h4{margin:0;text-wrap:balance;font-weight:600}
|
|
372
|
+
p{margin:0}
|
|
373
|
+
code{font:.86em/1.4 var(--mono);background:var(--bg);border:1px solid var(--line);padding:.05em .35em;border-radius:5px;overflow-wrap:anywhere}
|
|
374
|
+
.mono{font-family:var(--mono);font-size:.86em}
|
|
375
|
+
.quiet{color:var(--mute);font-size:13.5px}
|
|
376
|
+
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
377
|
+
.wrap{max-width:1240px;margin:0 auto;padding-left:max(20px,env(safe-area-inset-left));padding-right:max(20px,env(safe-area-inset-right))}
|
|
378
|
+
header.top{background:var(--panel);border-bottom:1px solid var(--line)}
|
|
379
|
+
header.top .wrap{padding-block:26px 0}
|
|
380
|
+
h1{font-family:var(--display);font-weight:700;font-size:clamp(26px,3.4vw,34px);line-height:1.1;letter-spacing:-.02em}
|
|
381
|
+
.title-row{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
|
|
382
|
+
.theme-btn{flex:none;display:inline-flex;align-items:center;gap:7px;height:36px;margin-top:1px;padding:0 14px 0 12px;border:1px solid var(--line2);border-radius:999px;background:var(--panel);color:var(--ink2);font:500 13.5px var(--sans);cursor:pointer}
|
|
383
|
+
.theme-btn[hidden]{display:none}.theme-btn:hover{color:var(--ink);border-color:var(--mute)}.theme-btn:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
|
|
384
|
+
.theme-btn svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
|
|
385
|
+
:root[data-theme="light"] .i-sun,:root:not([data-theme="light"]) .i-moon{display:none}
|
|
386
|
+
.meta{display:flex;flex-wrap:wrap;gap:4px 14px;color:var(--mute);font-size:13.5px;margin-top:6px}
|
|
387
|
+
.meta>*+*::before{content:"·";margin-right:14px;color:var(--line2)}
|
|
388
|
+
.lede{max-width:78ch;margin-top:14px;color:var(--ink2)}
|
|
389
|
+
.lede-more summary{cursor:pointer;color:var(--blue);font-size:13.5px;font-weight:600;margin-top:6px;list-style:none}
|
|
390
|
+
.lede-more summary::-webkit-details-marker{display:none}
|
|
391
|
+
.lede-more p{margin-top:6px}
|
|
392
|
+
.tabs{display:flex;gap:26px;margin-top:20px;overflow-x:auto;scrollbar-width:none}
|
|
393
|
+
.tabs::-webkit-scrollbar{display:none}
|
|
394
|
+
.tab{appearance:none;background:none;border:0;border-bottom:2px solid transparent;padding:10px 0 12px;font:600 14.5px var(--sans);color:var(--mute);cursor:pointer;white-space:nowrap;display:flex;gap:8px;align-items:center}
|
|
395
|
+
.tab:hover{color:var(--ink)}
|
|
396
|
+
.tab[aria-selected=true]{color:var(--ink);border-bottom-color:var(--blue)}
|
|
397
|
+
.tab .cnt{font:500 12px var(--mono);color:var(--mute);background:var(--bg);border:1px solid var(--line);border-radius:999px;padding:0 7px}
|
|
398
|
+
html:not(.js) .tabs{display:none}
|
|
399
|
+
main{padding-block:26px 56px}
|
|
400
|
+
.tp{display:grid;gap:18px}
|
|
401
|
+
html.js .tp[hidden]{display:none}
|
|
402
|
+
html:not(.js) .tp+.tp{margin-top:40px}
|
|
403
|
+
html:not(.js) .tp::before{content:attr(data-title);font:600 20px var(--sans)}
|
|
404
|
+
.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--r);padding:22px 24px;box-shadow:var(--shadow)}
|
|
405
|
+
.panel h2{font-size:16.5px}
|
|
406
|
+
.ph{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}
|
|
407
|
+
.sub{color:var(--mute);font-size:13px}
|
|
408
|
+
/* overview */
|
|
409
|
+
.ov-top{display:grid;grid-template-columns:minmax(0,5fr) minmax(0,7fr);gap:18px;align-items:start}
|
|
410
|
+
.ov-left{display:grid;gap:18px;align-content:start}
|
|
411
|
+
.score-panel{display:grid;gap:12px;align-content:start}
|
|
412
|
+
.factors{align-self:start}
|
|
413
|
+
.big{display:flex;align-items:baseline;gap:6px;margin-top:6px}
|
|
414
|
+
.big .n{font:700 clamp(80px,10vw,124px)/.86 var(--display);letter-spacing:-.04em;font-variant-numeric:lining-nums}
|
|
415
|
+
.big .of{font:500 22px var(--mono);color:var(--mute)}
|
|
416
|
+
.b1-t{color:var(--b1-ink)}.b2-t{color:var(--b2-ink)}.b3-t{color:var(--ink)}.b4-t{color:var(--ink)}.b5-t{color:var(--b5-ink)}
|
|
417
|
+
.big.b3-t .n,.big.b4-t .n{color:var(--ink)}
|
|
418
|
+
.band{display:flex;flex-wrap:wrap;gap:10px;align-items:center;font-size:15.5px;font-weight:600}
|
|
419
|
+
.chip{font:600 12.5px var(--sans);padding:3px 10px;border-radius:999px;color:var(--chip-ink)}
|
|
420
|
+
.chip.b1{background:var(--b1-ink)}.chip.b2{background:var(--b2-ink)}.chip.b3{background:var(--b3);color:#2b2000}.chip.b4{background:var(--b4);color:#0f2a12}.chip.b5{background:var(--b5-ink)}
|
|
421
|
+
.scale{position:relative;margin:22px 0 18px}
|
|
422
|
+
.track{display:flex;gap:2px;height:12px;border-radius:6px;overflow:hidden}
|
|
423
|
+
.track span.b1{background:var(--b1)}.track span.b2{background:var(--b2)}.track span.b3{background:var(--b3)}.track span.b4{background:var(--b4)}.track span.b5{background:var(--b5)}
|
|
424
|
+
.marker{position:absolute;top:-8px;width:3px;height:28px;margin-left:-1.5px;background:var(--ink);border-radius:2px;box-shadow:0 0 0 2px var(--panel)}
|
|
425
|
+
.marker b{position:absolute;bottom:calc(100% + 4px);left:50%;transform:translateX(-50%);font:600 12px var(--mono);background:var(--ink);color:var(--panel);padding:1px 6px;border-radius:4px}
|
|
426
|
+
.ticks{position:relative;height:16px;margin-top:6px;font:12px var(--mono);color:var(--mute)}
|
|
427
|
+
.ticks span{position:absolute;transform:translateX(-50%)}.ticks span:first-child{transform:none}.ticks span:last-child{transform:translateX(-100%)}
|
|
428
|
+
.cap{color:var(--ink2)}
|
|
429
|
+
.unlock{display:grid;gap:6px;padding:14px 16px;border:1px solid var(--line2);border-radius:8px;background:var(--bg)}
|
|
430
|
+
.u-k{font-size:13.5px;font-weight:600;color:var(--ink2)}
|
|
431
|
+
.u-v{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px}
|
|
432
|
+
.u-v .from{font:600 20px var(--mono);color:var(--mute);text-decoration:line-through;text-decoration-thickness:1.5px}
|
|
433
|
+
.u-v .arrow{color:var(--mute);font-size:18px}
|
|
434
|
+
.u-v .to{font:700 46px/1 var(--display);letter-spacing:-.03em;font-variant-numeric:lining-nums}
|
|
435
|
+
.u-v .to.b3-t,.u-v .to.b4-t{color:var(--ink)}
|
|
436
|
+
.u-s{font-size:13.5px;color:var(--mute)}
|
|
437
|
+
.own{display:inline-block;font:600 11.5px/1.6 var(--sans);color:var(--ink);background:var(--panel);border:1px solid var(--line2);border-radius:999px;padding:0 8px;white-space:nowrap;vertical-align:1px}
|
|
438
|
+
.how summary{cursor:pointer;color:var(--blue);font-size:13.5px;font-weight:600;list-style:none}
|
|
439
|
+
.how summary::-webkit-details-marker{display:none}
|
|
440
|
+
.how p{margin-top:8px;font-size:13.5px;color:var(--mute);max-width:70ch}
|
|
441
|
+
.area-list{list-style:none;margin:14px 0 0;padding:0}
|
|
442
|
+
.area{display:grid;grid-template-columns:14px minmax(0,1fr) minmax(80px,160px) 64px;gap:14px;align-items:center;padding:11px 8px;margin:0 -8px;border-top:1px solid var(--line);color:inherit;text-decoration:none;border-radius:6px}
|
|
443
|
+
.area-list li:first-child .area{border-top:0}
|
|
444
|
+
.area:hover{background:var(--bg)}
|
|
445
|
+
.an{min-width:0}.an b{display:block;font-weight:600}.an>span{display:block;color:var(--mute);font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
446
|
+
.an>span.reason{white-space:normal}
|
|
447
|
+
.more{display:inline!important;color:var(--mute)}
|
|
448
|
+
.meter{height:8px;background:var(--line);border-radius:4px;overflow:hidden}
|
|
449
|
+
.meter i{display:block;height:100%;border-radius:4px;background:var(--neutral)}
|
|
450
|
+
.as{font:600 16px var(--mono);text-align:right}
|
|
451
|
+
.as.b3-t,.as.b4-t{color:var(--ink)}
|
|
452
|
+
.dot{display:inline-block;border-radius:50%;flex:none;justify-self:center}
|
|
453
|
+
.d-blocker{width:12px;height:12px;background:var(--blocker)}.d-high{width:10px;height:10px;background:var(--high)}.d-needs-decision{width:10px;height:10px;background:var(--decision)}.d-medium{width:8px;height:8px;background:var(--medium)}.d-low{width:7px;height:7px;background:var(--low)}.d-pass{width:8px;height:8px;background:var(--pass)}
|
|
454
|
+
.ov-right{display:grid;gap:18px;align-content:start}
|
|
455
|
+
.panel.stats{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr) minmax(0,1fr);padding:0}
|
|
456
|
+
.stat{display:grid;gap:8px;align-content:start;padding:16px 18px}
|
|
457
|
+
.stat+.stat{border-left:1px solid var(--line)}
|
|
458
|
+
.stat h3{font-size:13.5px;font-weight:600;color:var(--ink2)}
|
|
459
|
+
.stat-n{color:var(--mute);font-size:13.5px}.stat-n .n{font:600 26px/1 var(--mono);color:var(--ink);margin-right:4px}
|
|
460
|
+
.key{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:6px;vertical-align:-1px}.k-fail{background:var(--ink2)}
|
|
461
|
+
.delta{font-size:13.5px;color:var(--mute)}.delta b{font:600 14px var(--mono)}.delta.up b{color:var(--b5-ink)}.delta.down b{color:var(--b1-ink)}
|
|
462
|
+
.ascore{font:500 12.5px var(--mono);color:var(--mute);margin-left:6px}
|
|
463
|
+
.as small{font:500 11px var(--sans);color:var(--mute);margin-left:2px}
|
|
464
|
+
.as.ok{color:var(--b5-ink)}
|
|
465
|
+
.stack{display:flex;gap:2px;height:10px;border-radius:5px;overflow:hidden;background:var(--line)}
|
|
466
|
+
.s-blocker{background:var(--blocker)}.s-high{background:var(--high)}.s-needs-decision{background:var(--decision)}.s-medium{background:var(--medium)}.s-low{background:var(--low)}
|
|
467
|
+
.s-fixed,.s-pass{background:var(--pass)}.s-rest{background:var(--line2)}.s-fail{background:var(--ink2)}
|
|
468
|
+
.legend{list-style:none;margin:2px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:4px 12px;font-size:13px}
|
|
469
|
+
.legend li{display:inline-flex;gap:6px;align-items:center}.legend b{font:600 12.5px var(--mono)}
|
|
470
|
+
.fixfirst ol{list-style:none;margin:10px 0 0;padding:0}
|
|
471
|
+
.fixfirst ol a{display:grid;grid-template-columns:14px 64px minmax(0,1fr) 16px;gap:12px;align-items:center;padding:11px 8px;margin:0 -8px;border-top:1px solid var(--line);color:inherit;text-decoration:none;border-radius:6px}
|
|
472
|
+
.fixfirst li:first-child a{border-top:0}
|
|
473
|
+
.fixfirst ol a:hover{background:var(--bg)}
|
|
474
|
+
.fixfirst .t{font-weight:600;min-width:0}.fixfirst .c{display:none}
|
|
475
|
+
.fixfirst svg,.link svg{width:15px;height:15px;color:var(--mute)}
|
|
476
|
+
.sev-t{font-size:12.5px;font-weight:600;color:var(--mute);letter-spacing:.01em}
|
|
477
|
+
.link{display:inline-flex;gap:6px;align-items:center;font-weight:600;font-size:13.5px;color:var(--blue);text-decoration:none;background:none;border:0;padding:0;cursor:pointer;font-family:inherit}
|
|
478
|
+
/* findings */
|
|
479
|
+
.toolbar{display:flex;flex-wrap:wrap;gap:10px 12px;align-items:center;position:sticky;top:0;z-index:3;background:var(--bg);padding:10px 0;border-bottom:1px solid var(--line)}
|
|
480
|
+
.search{display:flex;align-items:center;gap:8px;background:var(--panel);border:1px solid var(--line2);border-radius:8px;padding:0 10px;flex:1 1 220px;max-width:340px}
|
|
481
|
+
.search svg{width:15px;height:15px;color:var(--mute)}
|
|
482
|
+
.search input{border:0;background:none;color:var(--ink);font:14px var(--sans);padding:8px 0;width:100%;outline:none}
|
|
483
|
+
.search:focus-within{outline:2px solid var(--blue);outline-offset:1px}
|
|
484
|
+
.seg{display:flex;flex-wrap:wrap;gap:4px}
|
|
485
|
+
.segb{display:inline-flex;gap:6px;align-items:center;font:500 13.5px var(--sans);color:var(--ink2);background:var(--panel);border:1px solid var(--line2);border-radius:8px;padding:6px 10px;cursor:pointer}
|
|
486
|
+
.segb:hover{border-color:var(--mute)}
|
|
487
|
+
.segb[aria-pressed=true]{background:var(--ink);color:var(--panel);border-color:var(--ink)}
|
|
488
|
+
.segb .mono{color:inherit;opacity:.7}
|
|
489
|
+
.sel select{font:14px var(--sans);color:var(--ink);background:var(--panel);border:1px solid var(--line2);border-radius:8px;padding:7px 10px}
|
|
490
|
+
.showing{margin-left:auto;color:var(--mute);font-size:13.5px}
|
|
491
|
+
.flist{display:grid;gap:8px}
|
|
492
|
+
.f{background:var(--panel);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow);transition:opacity .25s cubic-bezier(.2,.8,.2,1)}
|
|
493
|
+
.flist.focus .f:not(.open){background:var(--bg);border-color:var(--line)}
|
|
494
|
+
.flist.focus .f:not(.open) .dot{opacity:.55}
|
|
495
|
+
.flist.focus .f:not(.open):hover{background:var(--panel)}
|
|
496
|
+
.f.open{border-color:var(--blue);box-shadow:0 0 0 1px var(--blue)}
|
|
497
|
+
.f:has(.f-head:focus-visible){outline:2px solid var(--blue);outline-offset:2px}
|
|
498
|
+
.f h3{font-size:inherit}
|
|
499
|
+
.f-head{all:unset;box-sizing:border-box;width:100%;cursor:pointer;display:grid;grid-template-columns:14px minmax(0,1fr) auto auto 16px;gap:4px 14px;align-items:center;padding:14px 18px;border-radius:var(--r)}
|
|
500
|
+
.f-head:focus-visible{outline:none}
|
|
501
|
+
.f-title{font-weight:600;font-size:15.5px;line-height:1.4;min-width:0}
|
|
502
|
+
.f-meta{grid-column:2;grid-row:2;display:flex;flex-wrap:wrap;gap:4px 12px;color:var(--mute);font-size:13px}
|
|
503
|
+
.f-head .st,.f-head .stamp{grid-row:1/3;grid-column:4}
|
|
504
|
+
.chev{width:16px;height:16px;color:var(--mute);grid-row:1/3;grid-column:5;transition:transform .2s cubic-bezier(.2,.8,.2,1)}
|
|
505
|
+
.f.open .chev{transform:rotate(90deg)}
|
|
506
|
+
.f .dot{grid-row:1;align-self:center}
|
|
507
|
+
.st{font:600 12px var(--sans);color:var(--ink2);border:1px solid var(--line2);border-radius:999px;padding:2px 9px;white-space:nowrap}
|
|
508
|
+
.st-needs-decision{color:var(--decision);border-color:currentColor}
|
|
509
|
+
.stamp{display:inline-flex;gap:5px;align-items:center;font:700 11.5px var(--sans);letter-spacing:.08em;text-transform:uppercase;color:var(--fixed);border:1.5px solid currentColor;border-radius:5px;padding:2px 8px;transform:rotate(-2deg);white-space:nowrap}
|
|
510
|
+
.stamp svg{width:12px;height:12px}
|
|
511
|
+
.f.is-fixed .f-title{color:var(--ink2)}
|
|
512
|
+
.f-body{display:none;padding:4px 18px 20px 46px}
|
|
513
|
+
.f.open .f-body,html:not(.js) .f-body{display:grid;gap:18px}
|
|
514
|
+
.f-cols{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:22px}
|
|
515
|
+
.f-cols>div{display:grid;gap:8px;align-content:start}
|
|
516
|
+
.f-body h4,.ev h4{font-size:12.5px;font-weight:600;color:var(--mute);letter-spacing:.02em;margin-top:4px}
|
|
517
|
+
.f-body p{max-width:70ch}
|
|
518
|
+
.howfix{background:var(--blue-soft);border-radius:8px;padding:12px 14px;display:grid;gap:6px}
|
|
519
|
+
.howfix h4{color:var(--blue);margin:0}
|
|
520
|
+
.dec-inline{background:var(--dec-soft);border-radius:8px;padding:12px 14px;display:grid;gap:6px}.dec-inline h4{color:var(--decision);margin:0}
|
|
521
|
+
.dec-inline ul,.opts{margin:0;padding-left:18px}
|
|
522
|
+
.donebox{background:var(--ok-soft);border-radius:8px;padding:12px 14px;display:grid;gap:6px}.donebox h4{color:var(--fixed);margin:0}
|
|
523
|
+
.donebox svg,.quiet svg{width:13px;height:13px;vertical-align:-2px;color:var(--fixed)}
|
|
524
|
+
.files{display:flex;flex-wrap:wrap;gap:6px}
|
|
525
|
+
.ev{display:grid;gap:8px}
|
|
526
|
+
.tablewrap{overflow-x:auto;border:1px solid var(--line);border-radius:8px}
|
|
527
|
+
table{border-collapse:collapse;width:100%;font-size:13.5px}
|
|
528
|
+
th,td{text-align:left;vertical-align:top;padding:8px 12px;border-top:1px solid var(--line)}
|
|
529
|
+
thead th{border-top:0;font-size:12px;font-weight:600;color:var(--mute);background:var(--bg)}
|
|
530
|
+
td:first-child{width:52%;overflow-wrap:anywhere}
|
|
531
|
+
.empty{color:var(--mute);text-align:center;padding:30px}
|
|
532
|
+
/* decisions, changes, passed, limits */
|
|
533
|
+
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:18px}
|
|
534
|
+
.dcard{display:grid;gap:10px;align-content:start}
|
|
535
|
+
.dcard h3{font-size:16.5px}
|
|
536
|
+
.idlink{text-decoration:none;color:var(--mute)}
|
|
537
|
+
.rec{background:var(--dec-soft);border-radius:8px;padding:10px 12px}.rec strong{display:block;color:var(--decision);font-size:12.5px}
|
|
538
|
+
.changes{list-style:none;margin:0;padding:0;display:grid;gap:10px}
|
|
539
|
+
.changes li{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:16px;align-items:start}
|
|
540
|
+
.changes h3{font-size:15.5px}.changes h3 a{color:inherit;text-decoration:none}.changes h3 a:hover{text-decoration:underline}
|
|
541
|
+
.changes li>div{display:grid;gap:6px}
|
|
542
|
+
.pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:18px}
|
|
543
|
+
.pgroup h3{font-size:15px;display:flex;justify-content:space-between}
|
|
544
|
+
.pgroup ul{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:8px;font-size:14px}
|
|
545
|
+
.pgroup li{display:grid;grid-template-columns:16px 1fr;gap:8px}
|
|
546
|
+
.pgroup li svg{width:15px;height:15px;color:var(--pass);margin-top:3px}
|
|
547
|
+
.limits{display:grid;gap:18px}
|
|
548
|
+
.limits .panel{display:grid;gap:10px}
|
|
549
|
+
.lim{list-style:none;margin:0;padding:0;display:grid}
|
|
550
|
+
.lim li{display:grid;grid-template-columns:minmax(0,260px) minmax(0,1fr);gap:16px;padding:10px 0;border-top:1px solid var(--line)}
|
|
551
|
+
.lim li:first-child{border-top:0}.lim li span{color:var(--ink2)}
|
|
552
|
+
.lim li:not(:has(b)){grid-template-columns:1fr}
|
|
553
|
+
.empty-state{display:grid;gap:8px;text-align:center;padding:48px 24px}.empty-state p{color:var(--mute);max-width:56ch;margin:0 auto}
|
|
554
|
+
footer{border-top:1px solid var(--line);color:var(--mute);font-size:13px}
|
|
555
|
+
footer .wrap{padding-block:20px 40px;display:flex;flex-wrap:wrap;gap:6px 18px;justify-content:space-between}
|
|
556
|
+
@media (max-width:900px){.ov-top{grid-template-columns:1fr}.stat+.stat{border-left:0;border-top:1px solid var(--line)}.f-cols{grid-template-columns:1fr}}
|
|
557
|
+
@media (max-width:560px){.panel.stats{grid-template-columns:1fr}.stat+.stat{border-left:0;border-top:1px solid var(--line)}.tabs{-webkit-mask-image:linear-gradient(90deg,var(--ink) calc(100% - 28px),transparent);mask-image:linear-gradient(90deg,var(--ink) calc(100% - 28px),transparent);padding-right:28px}.panel{padding:18px}.meta{gap:2px 12px}.meta>*+*::before{display:none}.ticks span:nth-child(5){display:none}.area{grid-template-columns:14px minmax(0,1fr) 56px}.meter{display:none}
|
|
558
|
+
.f-head{grid-template-columns:14px minmax(0,1fr) 16px;padding:14px}.f-head .st,.f-head .stamp{grid-column:2;grid-row:3;justify-self:start}.chev{grid-column:3}
|
|
559
|
+
.f-body{padding:4px 14px 18px}.fixfirst ol a{grid-template-columns:14px minmax(0,1fr) 16px}.fixfirst .sev-t,.fixfirst .c{display:none}
|
|
560
|
+
.lim li{grid-template-columns:1fr;gap:4px}.showing{margin-left:0;width:100%}.cards,.pgrid{grid-template-columns:1fr}.changes li{grid-template-columns:1fr}}
|
|
561
|
+
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
|
|
562
|
+
@media print{body{background:#fff}.tabs,.toolbar,.how,.theme-btn,footer .wrap>:last-child{display:none}html.js .tp[hidden]{display:grid}.tp+.tp{margin-top:28px}.f-body{display:grid!important}.chev{display:none}.panel,.f{box-shadow:none;break-inside:avoid}.flist.focus .f{background:#fff}}
|
|
563
|
+
`;
|
|
564
|
+
|
|
565
|
+
const JS = `
|
|
566
|
+
(function(){
|
|
567
|
+
var DEFAULT_TAB='${DEFAULT_TAB}';
|
|
568
|
+
var d=document;d.documentElement.classList.add('js');
|
|
569
|
+
var root=d.documentElement,tb=d.querySelector('.theme-btn');
|
|
570
|
+
if(tb){var syncTheme=function(){var light=root.dataset.theme==='light';tb.querySelector('.tl').textContent=light?'Dark':'Light';tb.setAttribute('aria-label','Switch to '+(light?'dark':'light')+' theme');};
|
|
571
|
+
tb.hidden=false;syncTheme();
|
|
572
|
+
tb.addEventListener('click',function(){var light=root.dataset.theme!=='light';if(light)root.dataset.theme='light';else delete root.dataset.theme;try{localStorage.setItem('seo-report-theme',light?'light':'dark')}catch(e){}syncTheme();});}
|
|
573
|
+
var tabs=[].slice.call(d.querySelectorAll('.tab')),panels=[].slice.call(d.querySelectorAll('.tp'));
|
|
574
|
+
function show(name,focusTab){var ok=false;tabs.forEach(function(t){var on=t.dataset.tab===name;t.setAttribute('aria-selected',on);t.tabIndex=on?0:-1;if(on){ok=true;if(focusTab)t.focus();}});
|
|
575
|
+
if(!ok)return false;panels.forEach(function(p){p.hidden=p.id!=='p-'+name;});return true;}
|
|
576
|
+
tabs.forEach(function(t,i){t.addEventListener('click',function(){history.replaceState(null,'','#'+t.dataset.tab);show(t.dataset.tab);});
|
|
577
|
+
t.addEventListener('keydown',function(e){var k=e.key,j=i;if(k==='ArrowRight')j=(i+1)%tabs.length;else if(k==='ArrowLeft')j=(i-1+tabs.length)%tabs.length;else if(k==='Home')j=0;else if(k==='End')j=tabs.length-1;else return;
|
|
578
|
+
e.preventDefault();history.replaceState(null,'','#'+tabs[j].dataset.tab);show(tabs[j].dataset.tab,true);});});
|
|
579
|
+
var list=d.getElementById('flist');
|
|
580
|
+
function setOpen(f,open){f.classList.toggle('open',open);f.querySelector('.f-head').setAttribute('aria-expanded',open);
|
|
581
|
+
if(list)list.classList.toggle('focus',!!list.querySelector('.f.open'));}
|
|
582
|
+
[].forEach.call(d.querySelectorAll('.f-head'),function(b){b.addEventListener('click',function(){var f=b.closest('.f');setOpen(f,!f.classList.contains('open'));});});
|
|
583
|
+
var state={sev:'all',status:'all',area:'all',q:''};
|
|
584
|
+
function apply(){if(!list)return;var n=0,all=list.children.length;[].forEach.call(list.children,function(f){
|
|
585
|
+
var ok=(state.sev==='all'||f.dataset.sev===state.sev)&&(state.status==='all'||f.dataset.status===state.status)&&(state.area==='all'||f.dataset.area===state.area)&&(!state.q||f.dataset.text.indexOf(state.q)>-1);
|
|
586
|
+
f.hidden=!ok;if(ok)n++;});
|
|
587
|
+
d.getElementById('showing').textContent=(n===all?all:n+' of '+all)+' findings';d.getElementById('fnone').hidden=n>0;}
|
|
588
|
+
[].forEach.call(d.querySelectorAll('.segb[data-sev]'),function(b){b.addEventListener('click',function(){[].forEach.call(d.querySelectorAll('.segb[data-sev]'),function(x){x.setAttribute('aria-pressed',x===b);});state.sev=b.dataset.sev;apply();});});
|
|
589
|
+
var pb=[].slice.call(d.querySelectorAll('.segb[data-pstatus]'));pb.forEach(function(b){b.addEventListener('click',function(){pb.forEach(function(x){x.setAttribute('aria-pressed',x===b);});var st=b.dataset.pstatus;[].forEach.call(d.querySelectorAll('.prow'),function(r){r.hidden=st!=='all'&&r.dataset.status!==st;});});});
|
|
590
|
+
var q=d.getElementById('q');if(q)q.addEventListener('input',function(){state.q=q.value.trim().toLowerCase();apply();});
|
|
591
|
+
var fs=d.getElementById('fstatus');if(fs)fs.addEventListener('change',function(){state.status=fs.value;apply();});
|
|
592
|
+
var fa=d.getElementById('farea');if(fa)fa.addEventListener('change',function(){state.area=fa.value;apply();});
|
|
593
|
+
var fr=d.getElementById('freset');if(fr)fr.addEventListener('click',function(){state={sev:'all',status:'all',area:'all',q:''};if(q)q.value='';if(fs)fs.value='all';if(fa)fa.value='all';
|
|
594
|
+
[].forEach.call(d.querySelectorAll('.segb[data-sev]'),function(x){x.setAttribute('aria-pressed',x.dataset.sev==='all');});apply();});
|
|
595
|
+
[].forEach.call(d.querySelectorAll('.area[data-sev]'),function(a){a.addEventListener('click',function(e){e.preventDefault();var b=d.querySelector('.segb[data-sev="'+a.dataset.sev+'"]');if(b)b.click();history.replaceState(null,'','#findings');show('findings');window.scrollTo(0,0);});});
|
|
596
|
+
[].forEach.call(d.querySelectorAll('.area[data-area]'),function(a){a.addEventListener('click',function(e){e.preventDefault();if(fa){fa.value=a.dataset.area;state.area=a.dataset.area;apply();}
|
|
597
|
+
history.replaceState(null,'','#findings');show('findings');window.scrollTo(0,0);});});
|
|
598
|
+
function route(e){var h=decodeURIComponent(location.hash.slice(1));if(!h){show(DEFAULT_TAB);return;}
|
|
599
|
+
if(show(h))return;var f=d.getElementById(h);if(f&&f.classList.contains('f')){show('findings');f.hidden=false;setOpen(f,true);f.scrollIntoView({block:'start'});if(e)f.querySelector('.f-head').focus({preventScroll:true});}else show(DEFAULT_TAB);}
|
|
600
|
+
window.addEventListener('beforeprint',function(){[].forEach.call(d.querySelectorAll('.prow'),function(r){r.open=true;});});
|
|
601
|
+
window.addEventListener('hashchange',route);route();
|
|
602
|
+
})();
|
|
603
|
+
`;
|
|
604
|
+
|
|
605
|
+
const html = `<!doctype html>
|
|
606
|
+
<html lang="en">
|
|
607
|
+
<head>
|
|
608
|
+
<meta charset="utf-8">
|
|
609
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
610
|
+
<meta name="robots" content="noindex, nofollow">
|
|
611
|
+
<meta name="color-scheme" content="dark light">
|
|
612
|
+
<title>SEO report · ${esc(site.name)}</title>
|
|
613
|
+
<script>(function(h){h.classList.add('js');try{if(localStorage.getItem('seo-report-theme')==='light')h.dataset.theme='light'}catch(e){}})(document.documentElement)</script>
|
|
614
|
+
<style>${FONT_FACES}
|
|
615
|
+
${CSS}${plan ? PLAN_CSS : ""}</style>
|
|
616
|
+
</head>
|
|
617
|
+
<body>
|
|
618
|
+
<header class="top"><div class="wrap">
|
|
619
|
+
<div class="title-row"><h1>${esc(site.name)}</h1><button class="theme-btn" type="button" hidden><svg class="i-sun" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg><svg class="i-moon" viewBox="0 0 24 24" aria-hidden="true"><path d="M20 14.5A8 8 0 0 1 9.5 4a8 8 0 1 0 10.5 10.5z"/></svg><span class="tl">Light</span></button></div>
|
|
620
|
+
<p class="meta"><span>SEO report</span>${metaBits.map(b => `<span>${b}</span>`).join("")}</p>
|
|
621
|
+
${raw.summary ? (raw.summary.length <= 300 ? `<p class="lede">${inl(raw.summary)}</p>` : `<div class="lede"><p>${inl(firstSentence(raw.summary))}</p><details class="lede-more"><summary>Full summary</summary><p>${inl(raw.summary.slice(firstSentence(raw.summary).length).trim())}</p></details></div>`) : ""}
|
|
622
|
+
<nav class="tabs" role="tablist" aria-label="Report sections">${tabs.map(([id, label, n], i) => `<button class="tab" role="tab" id="t-${id}" data-tab="${id}" aria-controls="p-${id}" aria-selected="${i === 0}" tabindex="${i === 0 ? 0 : -1}">${label}${n != null ? `<span class="cnt">${n}</span>` : ""}</button>`).join("")}</nav>
|
|
623
|
+
</div></header>
|
|
624
|
+
<main class="wrap">
|
|
625
|
+
${tabs.map(([id, label]) => `<section class="tp" id="p-${id}" role="tabpanel" aria-labelledby="t-${id}" data-title="${label}"${id === DEFAULT_TAB ? "" : " hidden"}>${PANELS[id]()}</section>`).join("\n ")}
|
|
626
|
+
</main>
|
|
627
|
+
<footer><div class="wrap"><span>${mdFile ? `Full detail for every finding: <code>${esc(mdFile)}</code> in the same folder.` : ""}</span><span>Generated by the seo-supervisor skill${run.auditor && run.auditor !== "seo-supervisor" ? ` · ${esc(run.auditor)}` : ""} · ${esc(fmtDate(run.date))}</span></div></footer>
|
|
628
|
+
<script>${JS}</script>
|
|
629
|
+
</body>
|
|
630
|
+
</html>
|
|
631
|
+
`;
|
|
632
|
+
|
|
633
|
+
// ---------- markdown ----------
|
|
634
|
+
function markdown() {
|
|
635
|
+
const L = [];
|
|
636
|
+
const mdEsc = s => String(s ?? "").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
|
|
637
|
+
L.push(`# SEO report: ${site.name}`, "");
|
|
638
|
+
L.push([site.url, run.pagesCrawled != null && `${run.pagesCrawled} pages crawled`, site.framework, (site.siteTypes || []).join(", "), fmtDate(run.date), run.mode].filter(Boolean).join(" · "), "");
|
|
639
|
+
if (overall) {
|
|
640
|
+
L.push(`**SEO health score: ${overall.value}/100 (${bandOf(overall.value)[1]}).** ${verdict}.`, "");
|
|
641
|
+
const delta = deltaOf(), md = h => h.replace(/<\/?b>/g, "**").replace(/<[^>]+>/g, "");
|
|
642
|
+
if (overall.cap) {
|
|
643
|
+
L.push(`${plural(overall.blockers, "open blocker")} hold${overall.blockers === 1 ? "s" : ""} the score at ${overall.cap} until fixed.`, "");
|
|
644
|
+
const owner = openBlockers.filter(needsYou).map(f => f.id);
|
|
645
|
+
L.push(`**Fix ${openBlockers.length === 1 ? "the blocker" : `the ${openBlockers.length} blockers`} and the score rises to ${unlock.value}/100 (${bandOf(unlock.value)[1]}).**${delta?.inUnlock ? ` ${md(delta.html)}.` : ""}${owner.length ? ` ${owner.join(", ")} need${owner.length === 1 ? "s" : ""} you: the agent won't change ${owner.length === 1 ? "it" : "them"} without your go-ahead.` : ""}`, "");
|
|
646
|
+
}
|
|
647
|
+
if (delta && !delta.inUnlock) L.push(`${md(delta.html)}.`, "");
|
|
648
|
+
}
|
|
649
|
+
if (raw.summary) L.push(raw.summary, "");
|
|
650
|
+
L.push(`Open: ${open.length} (${SEV.map(s => `${countSev(s)} ${SEV_LABEL[s].toLowerCase()}`).join(", ")}) · Fixed: ${fixed.length} · Rules passing: ${overall ? `${overall.passing} of ${overall.rules}` : "n/a"}`, "");
|
|
651
|
+
if (areas.length) {
|
|
652
|
+
L.push("## Area scores", "", "| Area | Score | Open findings | Top issue |", "| --- | ---: | ---: | --- |");
|
|
653
|
+
for (const a of areas) L.push(`| ${mdEsc(a.name)} | ${a.value} | ${a.top.length} | ${mdEsc(a.top[0]?.title || "All checks pass")} |`);
|
|
654
|
+
L.push("");
|
|
655
|
+
}
|
|
656
|
+
if (plan) L.push(...planMarkdown(plan));
|
|
657
|
+
if (decisions.length) {
|
|
658
|
+
L.push("## Decisions needed", "");
|
|
659
|
+
for (const d of decisions) {
|
|
660
|
+
L.push(`### ${d.id ? `${d.id}: ` : ""}${d.question}`, "");
|
|
661
|
+
if (d.context) L.push(d.context, "");
|
|
662
|
+
for (const o of d.options || []) L.push(`- ${o}`);
|
|
663
|
+
if ((d.options || []).length) L.push("");
|
|
664
|
+
if (d.recommendation) L.push(`**Recommended:** ${d.recommendation}`, "");
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (fixed.length) {
|
|
668
|
+
L.push("## What was changed", "");
|
|
669
|
+
for (const f of fixed) L.push(`- **${f.id}** ${f.title}${f.fixed?.summary ? `: ${f.fixed.summary}` : ""}${(f.fixed?.files || []).length ? ` (${f.fixed.files.map(x => "`" + x + "`").join(", ")})` : ""}${f.fixed?.verified ? `. Verified: ${f.fixed.verified}` : ""}`);
|
|
670
|
+
L.push("");
|
|
671
|
+
}
|
|
672
|
+
L.push("## Findings", "");
|
|
673
|
+
for (const f of findings) {
|
|
674
|
+
L.push(`### ${f.id} · ${SEV_LABEL[f.severity]}${needsYou(f) ? " · Needs you" : ""} · ${f.title}`, "");
|
|
675
|
+
L.push(`Status: ${STATUS_LABEL[f.status] || f.status} · Area: ${f.category}${f.rule ? ` · Rule: ${f.rule}` : ""}${f.count ? ` · Cases: ${f.count}` : ""}`, "");
|
|
676
|
+
if (f.what) L.push(`**What's wrong.** ${f.what}`, "");
|
|
677
|
+
if (f.why) L.push(`**Why it matters.** ${f.why}`, "");
|
|
678
|
+
if (f.fix) L.push(`**How to fix.** ${f.fix}`, "");
|
|
679
|
+
if (f.decision) { L.push(`**Decision needed.** ${f.decision.question || ""}`, ""); for (const o of f.decision.options || []) L.push(`- ${o}`); if ((f.decision.options || []).length) L.push(""); if (f.decision.recommendation) L.push(`Recommended: ${f.decision.recommendation}`, ""); }
|
|
680
|
+
if (f.fixed) L.push(`**What was done.** ${f.fixed.summary || ""}${(f.fixed.files || []).length ? ` Files: ${f.fixed.files.map(x => "`" + x + "`").join(", ")}.` : ""}${f.fixed.verified ? ` Verified: ${f.fixed.verified}.` : ""}`, "");
|
|
681
|
+
if ((f.evidence || []).length) {
|
|
682
|
+
L.push("| Where | Detail |", "| --- | --- |");
|
|
683
|
+
for (const e of f.evidence) L.push(`| ${mdEsc([e.url, e.file && `\`${e.file}${e.line ? ":" + e.line : ""}\``].filter(Boolean).join(" "))} | ${mdEsc(e.detail || "")} |`);
|
|
684
|
+
if (f.count > f.evidence.length) L.push("", `${f.count - f.evidence.length} more cases not listed.`);
|
|
685
|
+
L.push("");
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
if (passed.length) {
|
|
689
|
+
L.push("## Passed checks", "");
|
|
690
|
+
for (const p of passed) L.push(`- **${p.rule}** ${p.title}${p.detail ? ` (${p.detail})` : ""}`);
|
|
691
|
+
L.push("");
|
|
692
|
+
}
|
|
693
|
+
if (notChecked.length || notes.length) {
|
|
694
|
+
L.push("## Limits of this audit", "");
|
|
695
|
+
for (const n of notChecked) L.push(`- **${n.area || n.rule}:** ${n.reason || ""}`);
|
|
696
|
+
for (const n of notes) L.push(`- ${n}`);
|
|
697
|
+
L.push("");
|
|
698
|
+
}
|
|
699
|
+
L.push("## How the score works", "", "Every checked rule is worth 10 points. A rule that passes, or whose findings are all fixed, earns 10. A rule with open findings earns by its worst one: low 8, medium or decision 6, high 3, blocker 0. The score is the share of points earned. Each open blocker caps it: one at 59, two at 49, three at 39. While a blocker is open, the panel also shows the score you reach once it is fixed. Area scores use the same rules within each area.", "");
|
|
700
|
+
return L.join("\n");
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
704
|
+
writeFileSync(outPath, html);
|
|
705
|
+
if (mdPath) writeFileSync(mdPath, markdown());
|
|
706
|
+
console.log(`render-report: ${findings.length} findings (${open.length} open, ${fixed.length} fixed), score ${overall ? overall.value : "n/a"} → ${outPath}${mdPath ? " + " + basename(mdPath) : ""}`);
|