seo-supervisor 1.2.0 → 2.0.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/icon.png +0 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +16 -3
- package/CHANGELOG.md +430 -0
- package/NOTICE +7 -0
- package/README.md +230 -25
- package/agents/seo-auditor.md +16 -0
- package/agents/seo-reviewer.md +16 -0
- package/bin/agents.mjs +194 -29
- package/bin/extras.mjs +422 -0
- package/bin/prompt.mjs +34 -14
- package/bin/seo-supervisor.mjs +386 -53
- package/commands/seo-audit.md +29 -3
- package/commands/seo-brief.md +28 -0
- package/commands/seo-connect.md +27 -0
- package/commands/seo-fix.md +24 -3
- package/commands/seo-grow.md +26 -0
- package/commands/seo-launch.md +17 -3
- package/commands/seo-review.md +13 -1
- package/commands/seo-rewrite.md +25 -0
- package/commands/seo-setup.md +17 -1
- package/commands/seo-watch.md +28 -0
- package/hooks/hooks.json +117 -0
- package/package.json +20 -7
- package/skills/seo-supervisor/NOTICE +7 -0
- package/skills/seo-supervisor/SKILL.md +302 -21
- package/skills/seo-supervisor/audience.md +61 -0
- package/skills/seo-supervisor/examples/drafts/security.md +41 -0
- package/skills/seo-supervisor/examples/hooks/README.md +28 -0
- package/skills/seo-supervisor/examples/hooks/claude-code-settings.json +15 -0
- package/skills/seo-supervisor/examples/hooks/codex-hooks.json +17 -0
- package/skills/seo-supervisor/examples/hooks/copilot-hooks.json +15 -0
- package/skills/seo-supervisor/examples/hooks/cursor-hooks.json +11 -0
- package/skills/seo-supervisor/examples/hooks/github-actions.yml +21 -0
- package/skills/seo-supervisor/examples/hooks/pre-commit +17 -0
- package/skills/seo-supervisor/examples/hooks/reading-ease.yml +24 -0
- package/skills/seo-supervisor/examples/sample-audit.json +94 -2
- package/skills/seo-supervisor/examples/sample-report.html +111 -61
- package/skills/seo-supervisor/examples/sample-report.md +147 -44
- package/skills/seo-supervisor/examples/scheduled-runs.md +89 -0
- package/skills/seo-supervisor/examples/snippets.md +648 -1
- package/skills/seo-supervisor/grow.md +342 -0
- package/skills/seo-supervisor/og-images.md +85 -0
- package/skills/seo-supervisor/page-types.md +124 -0
- package/skills/seo-supervisor/planning.md +19 -7
- package/skills/seo-supervisor/profile-template.md +41 -0
- package/skills/seo-supervisor/report-format.md +177 -10
- package/skills/seo-supervisor/rewrite.md +59 -0
- package/skills/seo-supervisor/rules/ai-search.md +65 -12
- package/skills/seo-supervisor/rules/content.md +33 -9
- package/skills/seo-supervisor/rules/crawl-index.md +33 -6
- package/skills/seo-supervisor/rules/internal-linking.md +49 -6
- package/skills/seo-supervisor/rules/launch-monitoring.md +17 -8
- package/skills/seo-supervisor/rules/media.md +13 -1
- package/skills/seo-supervisor/rules/metadata.md +41 -9
- package/skills/seo-supervisor/rules/performance.md +50 -5
- package/skills/seo-supervisor/rules/rendering.md +39 -2
- package/skills/seo-supervisor/rules/search-intent.md +32 -0
- package/skills/seo-supervisor/rules/sitemaps-robots.md +24 -12
- package/skills/seo-supervisor/rules/structured-data.md +37 -14
- package/skills/seo-supervisor/rules/trust-security.md +25 -2
- package/skills/seo-supervisor/rules/urls.md +10 -2
- package/skills/seo-supervisor/scripts/ai-answers.mjs +314 -0
- package/skills/seo-supervisor/scripts/backlinks.mjs +412 -0
- package/skills/seo-supervisor/scripts/change-check.mjs +281 -0
- package/skills/seo-supervisor/scripts/checks/agents.mjs +488 -0
- package/skills/seo-supervisor/scripts/checks/assets.mjs +404 -0
- package/skills/seo-supervisor/scripts/checks/bots.mjs +146 -0
- package/skills/seo-supervisor/scripts/checks/business-type.mjs +193 -0
- package/skills/seo-supervisor/scripts/checks/content.mjs +391 -0
- package/skills/seo-supervisor/scripts/checks/coverage.mjs +184 -0
- package/skills/seo-supervisor/scripts/checks/crawl.mjs +95 -0
- package/skills/seo-supervisor/scripts/checks/hreflang.mjs +396 -0
- package/skills/seo-supervisor/scripts/checks/hygiene.mjs +227 -0
- package/skills/seo-supervisor/scripts/checks/lighthouse.mjs +271 -0
- package/skills/seo-supervisor/scripts/checks/link-strength.mjs +59 -0
- package/skills/seo-supervisor/scripts/checks/links.mjs +360 -0
- package/skills/seo-supervisor/scripts/checks/local.mjs +101 -0
- package/skills/seo-supervisor/scripts/checks/media.mjs +194 -0
- package/skills/seo-supervisor/scripts/checks/outbound.mjs +53 -0
- package/skills/seo-supervisor/scripts/checks/page.mjs +223 -0
- package/skills/seo-supervisor/scripts/checks/probes.mjs +130 -0
- package/skills/seo-supervisor/scripts/checks/render.mjs +552 -0
- package/skills/seo-supervisor/scripts/checks/robots.mjs +144 -0
- package/skills/seo-supervisor/scripts/checks/schema.mjs +206 -0
- package/skills/seo-supervisor/scripts/checks/site-agents.mjs +79 -0
- package/skills/seo-supervisor/scripts/checks/site-content.mjs +135 -0
- package/skills/seo-supervisor/scripts/checks/site-hygiene.mjs +202 -0
- package/skills/seo-supervisor/scripts/checks/site-pages.mjs +474 -0
- package/skills/seo-supervisor/scripts/checks/site-security.mjs +102 -0
- package/skills/seo-supervisor/scripts/checks/sitemap.mjs +473 -0
- package/skills/seo-supervisor/scripts/checks/speed.mjs +267 -0
- package/skills/seo-supervisor/scripts/checks/technical.mjs +368 -0
- package/skills/seo-supervisor/scripts/checks/tls.mjs +297 -0
- package/skills/seo-supervisor/scripts/checks/trust.mjs +421 -0
- package/skills/seo-supervisor/scripts/checks/visual.mjs +1132 -0
- package/skills/seo-supervisor/scripts/checks/writing.mjs +192 -0
- package/skills/seo-supervisor/scripts/commoncrawl.mjs +452 -0
- package/skills/seo-supervisor/scripts/connect-keys.mjs +422 -0
- package/skills/seo-supervisor/scripts/content-scan.mjs +515 -158
- package/skills/seo-supervisor/scripts/crawl/catalog.mjs +1248 -0
- package/skills/seo-supervisor/scripts/crawl/fetch.mjs +362 -0
- package/skills/seo-supervisor/scripts/crawl/page.mjs +741 -0
- package/skills/seo-supervisor/scripts/crawl/queue.mjs +190 -0
- package/skills/seo-supervisor/scripts/dashboard.mjs +140 -0
- package/skills/seo-supervisor/scripts/data/ai-bots.json +38 -0
- package/skills/seo-supervisor/scripts/data/build-schema-vocab.mjs +57 -0
- package/skills/seo-supervisor/scripts/data/business-types.json +338 -0
- package/skills/seo-supervisor/scripts/data/google-rich-results.json +79 -0
- package/skills/seo-supervisor/scripts/data/schema-vocab.json +1 -0
- package/skills/seo-supervisor/scripts/deploy-check.mjs +462 -0
- package/skills/seo-supervisor/scripts/disavow.mjs +176 -0
- package/skills/seo-supervisor/scripts/doctor.mjs +174 -0
- package/skills/seo-supervisor/scripts/geo-grid.mjs +371 -0
- package/skills/seo-supervisor/scripts/google/search-console.mjs +151 -0
- package/skills/seo-supervisor/scripts/google/session.mjs +167 -0
- package/skills/seo-supervisor/scripts/google-updates.mjs +189 -0
- package/skills/seo-supervisor/scripts/google.mjs +1341 -0
- package/skills/seo-supervisor/scripts/gsc-import.mjs +298 -0
- package/skills/seo-supervisor/scripts/guard/adapters/claude-code.mjs +149 -0
- package/skills/seo-supervisor/scripts/guard/adapters/cline.mjs +28 -0
- package/skills/seo-supervisor/scripts/guard/adapters/codex.mjs +26 -0
- package/skills/seo-supervisor/scripts/guard/adapters/copilot.mjs +36 -0
- package/skills/seo-supervisor/scripts/guard/adapters/cursor.mjs +33 -0
- package/skills/seo-supervisor/scripts/guard/adapters/devin.mjs +25 -0
- package/skills/seo-supervisor/scripts/guard/adapters/edits.mjs +124 -0
- package/skills/seo-supervisor/scripts/guard/mode.mjs +37 -0
- package/skills/seo-supervisor/scripts/guard/rules.mjs +931 -0
- package/skills/seo-supervisor/scripts/guard.mjs +74 -0
- package/skills/seo-supervisor/scripts/images.mjs +408 -0
- package/skills/seo-supervisor/scripts/indexnow.mjs +300 -0
- package/skills/seo-supervisor/scripts/issues.mjs +217 -0
- package/skills/seo-supervisor/scripts/keys/authority.mjs +135 -0
- package/skills/seo-supervisor/scripts/keys/bing.mjs +239 -0
- package/skills/seo-supervisor/scripts/keys/clarity.mjs +137 -0
- package/skills/seo-supervisor/scripts/keys/dataforseo.mjs +57 -0
- package/skills/seo-supervisor/scripts/keys/googleplaces.mjs +26 -0
- package/skills/seo-supervisor/scripts/keys/http.mjs +212 -0
- package/skills/seo-supervisor/scripts/keys/matomo.mjs +138 -0
- package/skills/seo-supervisor/scripts/keys/openai.mjs +26 -0
- package/skills/seo-supervisor/scripts/keys/perplexity.mjs +26 -0
- package/skills/seo-supervisor/scripts/keys/posthog.mjs +165 -0
- package/skills/seo-supervisor/scripts/keys/semrush.mjs +25 -0
- package/skills/seo-supervisor/scripts/keys/services.mjs +41 -0
- package/skills/seo-supervisor/scripts/keys/store.mjs +140 -0
- package/skills/seo-supervisor/scripts/keys/visits.mjs +58 -0
- package/skills/seo-supervisor/scripts/keys/youtube.mjs +84 -0
- package/skills/seo-supervisor/scripts/keyword-data.mjs +316 -0
- package/skills/seo-supervisor/scripts/keyword-ideas.mjs +503 -0
- package/skills/seo-supervisor/scripts/lib/args.mjs +56 -0
- package/skills/seo-supervisor/scripts/lib/business.mjs +27 -0
- package/skills/seo-supervisor/scripts/lib/cdp.mjs +242 -0
- package/skills/seo-supervisor/scripts/lib/cli.mjs +56 -0
- package/skills/seo-supervisor/scripts/lib/csv.mjs +38 -0
- package/skills/seo-supervisor/scripts/lib/findings.mjs +100 -0
- package/skills/seo-supervisor/scripts/lib/google-client.mjs +9 -0
- package/skills/seo-supervisor/scripts/lib/html.mjs +146 -0
- package/skills/seo-supervisor/scripts/lib/http.mjs +28 -0
- package/skills/seo-supervisor/scripts/lib/image-size.mjs +78 -0
- package/skills/seo-supervisor/scripts/lib/is-main.mjs +13 -0
- package/skills/seo-supervisor/scripts/lib/net.mjs +116 -0
- package/skills/seo-supervisor/scripts/lib/proxy.mjs +47 -0
- package/skills/seo-supervisor/scripts/lib/recheck.mjs +106 -0
- package/skills/seo-supervisor/scripts/lib/redact.mjs +78 -0
- package/skills/seo-supervisor/scripts/lib/robots.mjs +73 -0
- package/skills/seo-supervisor/scripts/lib/score.mjs +266 -0
- package/skills/seo-supervisor/scripts/lib/settings-dir.mjs +81 -0
- package/skills/seo-supervisor/scripts/links-import.mjs +603 -0
- package/skills/seo-supervisor/scripts/log-scan.mjs +597 -0
- package/skills/seo-supervisor/scripts/og-card.mjs +273 -0
- package/skills/seo-supervisor/scripts/osm.mjs +359 -0
- package/skills/seo-supervisor/scripts/rdap.mjs +164 -0
- package/skills/seo-supervisor/scripts/render-report.mjs +324 -690
- package/skills/seo-supervisor/scripts/report/client.js +37 -0
- package/skills/seo-supervisor/scripts/report/diff.mjs +264 -0
- package/skills/seo-supervisor/scripts/report/findings.mjs +165 -0
- package/skills/seo-supervisor/scripts/report/format.mjs +111 -0
- package/skills/seo-supervisor/scripts/report/markdown.mjs +250 -0
- package/skills/seo-supervisor/scripts/report/model.mjs +171 -0
- package/skills/seo-supervisor/scripts/report/overview-lines.mjs +158 -0
- package/skills/seo-supervisor/scripts/report/overview.mjs +224 -0
- package/skills/seo-supervisor/scripts/report/page.mjs +127 -0
- package/skills/seo-supervisor/scripts/report/panel.mjs +172 -0
- package/skills/seo-supervisor/scripts/report/panels/ai.mjs +211 -0
- package/skills/seo-supervisor/scripts/report/panels/connections.mjs +139 -0
- package/skills/seo-supervisor/scripts/report/panels/content.mjs +204 -0
- package/skills/seo-supervisor/scripts/report/panels/data-search.mjs +379 -0
- package/skills/seo-supervisor/scripts/report/panels/data-site.mjs +44 -0
- package/skills/seo-supervisor/scripts/report/panels/links.mjs +380 -0
- package/skills/seo-supervisor/scripts/report/panels/local.mjs +221 -0
- package/skills/seo-supervisor/scripts/report/panels/site.mjs +359 -0
- package/skills/seo-supervisor/scripts/report/panels/speed-media.mjs +267 -0
- package/skills/seo-supervisor/scripts/report/sources.mjs +163 -0
- package/skills/seo-supervisor/scripts/report/styles.css +223 -0
- package/skills/seo-supervisor/scripts/report/traffic.mjs +264 -0
- package/skills/seo-supervisor/scripts/report-plan.mjs +112 -33
- package/skills/seo-supervisor/scripts/schema-check.mjs +717 -0
- package/skills/seo-supervisor/scripts/seo-crawl.mjs +1086 -638
- package/skills/seo-supervisor/scripts/seo-diff.mjs +584 -0
- package/skills/seo-supervisor/scripts/update-check.mjs +82 -0
- package/skills/seo-supervisor/site-types/content.md +34 -1
- package/skills/seo-supervisor/site-types/ecommerce.md +38 -1
- package/skills/seo-supervisor/site-types/local-business.md +96 -6
- package/skills/seo-supervisor/site-types/services.md +46 -0
- package/skills/seo-supervisor/site-types/tools.md +3 -3
- package/skills/seo-supervisor/strategy.md +232 -0
- package/skills/seo-supervisor/troubleshooting.md +56 -0
|
@@ -1,706 +1,340 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
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.
|
|
2
|
+
// @ts-check
|
|
3
|
+
// Renders an audit JSON (or raw seo-crawl / content-scan output) as one self-contained HTML page that makes no network
|
|
4
|
+
// requests, plus a Markdown copy with every finding in full. The JSON shape and score model are in ../report-format.md.
|
|
10
5
|
|
|
11
|
-
import { readFileSync, writeFileSync, mkdirSync
|
|
6
|
+
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
12
7
|
import { dirname, resolve, basename } from "node:path";
|
|
13
|
-
import {
|
|
8
|
+
import { SEV, bandOf } from "./lib/score.mjs";
|
|
9
|
+
import { isMain } from "./lib/is-main.mjs";
|
|
10
|
+
import { Fail, runMain } from "./lib/cli.mjs";
|
|
11
|
+
import { parseArgs } from "./lib/args.mjs";
|
|
12
|
+
import { SEV_LABEL, esc, link, mdLink, noteMd } from "./report/format.mjs";
|
|
13
|
+
import { buildModel } from "./report/model.mjs";
|
|
14
|
+
import { loadSources } from "./report/sources.mjs";
|
|
15
|
+
import { overviewLines } from "./report/overview-lines.mjs";
|
|
16
|
+
import { searchTraffic } from "./report/traffic.mjs";
|
|
17
|
+
import { diffParts } from "./report/diff.mjs";
|
|
18
|
+
import { findingTabs } from "./report/findings.mjs";
|
|
19
|
+
import { sitePanels } from "./report/panels/site.mjs";
|
|
20
|
+
import { linkPanels } from "./report/panels/links.mjs";
|
|
21
|
+
import { aiPanels } from "./report/panels/ai.mjs";
|
|
22
|
+
import { contentPanels } from "./report/panels/content.mjs";
|
|
23
|
+
import { speedPanels } from "./report/panels/speed-media.mjs";
|
|
24
|
+
import { localPanels } from "./report/panels/local.mjs";
|
|
25
|
+
import { connectionPanels } from "./report/panels/connections.mjs";
|
|
26
|
+
import {
|
|
27
|
+
logsPanel,
|
|
28
|
+
brandTrendPanel,
|
|
29
|
+
topSearchesPanel,
|
|
30
|
+
keywordIdeasPanel,
|
|
31
|
+
keywordDataPanel,
|
|
32
|
+
indexVerdictPanel,
|
|
33
|
+
} from "./report/panels/data-search.mjs";
|
|
34
|
+
import { schemaInventoryPanel } from "./report/panels/data-site.mjs";
|
|
35
|
+
import { overviewHtml } from "./report/overview.mjs";
|
|
36
|
+
import { pageHtml } from "./report/page.mjs";
|
|
37
|
+
import { markdown } from "./report/markdown.mjs";
|
|
38
|
+
import { byTab, deeper } from "./report/panel.mjs";
|
|
14
39
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Builds the report as text and writes nothing.
|
|
42
|
+
* @param {any} raw the parsed JSON
|
|
43
|
+
* @param {{ dir?: string, mdFile?: string | null }} [opts] dir: the audit's folder, whose settings.json applies;
|
|
44
|
+
* mdFile: the Markdown file's name for the page to mention, or null for no Markdown (md is then null too)
|
|
45
|
+
* @returns {{ html: string, md: string | null, receipt: string[] }} receipt: the lines printed before "Wrote:"
|
|
46
|
+
*/
|
|
47
|
+
export function render(raw, { dir = process.cwd(), mdFile = null } = {}) {
|
|
48
|
+
const { raw: full, notShown } = loadSources(raw, dir),
|
|
49
|
+
m = { raw: full, mdFile, notShown, ...buildModel(full, dir) }; // adds the result files beside the audit
|
|
50
|
+
const plan = raw.plan && typeof raw.plan === "object" ? raw.plan : null;
|
|
51
|
+
// Each module builds its parts from the model; what one needs from another is passed in by name.
|
|
52
|
+
const {
|
|
53
|
+
speedText,
|
|
54
|
+
authorityText,
|
|
55
|
+
ahrefsCredit,
|
|
56
|
+
labSpeedText,
|
|
57
|
+
lcpText,
|
|
58
|
+
lighthouseText,
|
|
59
|
+
googleUpdatesText,
|
|
60
|
+
desktopSpeedText,
|
|
61
|
+
} = overviewLines(m);
|
|
62
|
+
const { linked, links, moreLinks, outLinks, linkIdeas, queryGaps, linkedOnce, linkStrength } = linkPanels(m);
|
|
63
|
+
const {
|
|
64
|
+
trafficFor,
|
|
65
|
+
trafficOf,
|
|
66
|
+
trafficHtml,
|
|
67
|
+
clarityOf,
|
|
68
|
+
clarityHtml,
|
|
69
|
+
searchLines,
|
|
70
|
+
positionsText,
|
|
71
|
+
analyticsSplitLines,
|
|
72
|
+
} = searchTraffic(m, { linked });
|
|
73
|
+
const {
|
|
74
|
+
diff,
|
|
75
|
+
diffHtml,
|
|
76
|
+
posts,
|
|
77
|
+
timeline,
|
|
78
|
+
googlePostsText,
|
|
79
|
+
burstMd,
|
|
80
|
+
diffSections,
|
|
81
|
+
diffText,
|
|
82
|
+
unknownLines,
|
|
83
|
+
linksDroppedMd,
|
|
84
|
+
} = diffParts(m, { googleUpdatesText });
|
|
85
|
+
const { findingsHtml, decisionsHtml, changesHtml, passedHtml, limitsHtml, recheckNote, decisionCount } = findingTabs(
|
|
86
|
+
m,
|
|
87
|
+
{ trafficHtml, clarityHtml },
|
|
88
|
+
);
|
|
89
|
+
const {
|
|
90
|
+
viewsHtml,
|
|
91
|
+
viewsMd,
|
|
92
|
+
hstsPreload,
|
|
93
|
+
crawlCoverage,
|
|
94
|
+
browser,
|
|
95
|
+
pageScores,
|
|
96
|
+
checkSettings: checkSettingsPanel,
|
|
97
|
+
settingRows,
|
|
98
|
+
settingsSummary,
|
|
99
|
+
} = sitePanels(m);
|
|
100
|
+
const { agents, aiCrawlers, aiAnswers } = aiPanels(m);
|
|
101
|
+
const { writing, productData, descriptions, appsPdfs, audience } = contentPanels(m);
|
|
102
|
+
const { images, lighthouseDetail, speedDetails, a11y } = speedPanels(m);
|
|
103
|
+
const { local, geoGridHtml, geoGridMd } = localPanels(m);
|
|
104
|
+
const { connections, changeCheck, newSearches } = connectionPanels(m);
|
|
22
105
|
|
|
23
|
-
//
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
106
|
+
// The one-line summaries, each topic's as one panel of quiet lines at the top of its tab.
|
|
107
|
+
const lines = (title, list) => () => {
|
|
108
|
+
const l = list().filter(Boolean);
|
|
109
|
+
return l.length && { title, blocks: l.map(quiet => ({ quiet })) };
|
|
110
|
+
};
|
|
111
|
+
const searchGlance = lines("Search at a glance", () => [
|
|
112
|
+
...searchLines(),
|
|
113
|
+
positionsText(),
|
|
114
|
+
...analyticsSplitLines(),
|
|
115
|
+
googleUpdatesText() && { html: googleUpdatesText(true), md: googleUpdatesText() },
|
|
116
|
+
]);
|
|
117
|
+
const speedGlance = lines("Speed at a glance", () => [
|
|
118
|
+
speedText(),
|
|
119
|
+
desktopSpeedText(),
|
|
120
|
+
labSpeedText(),
|
|
121
|
+
lcpText(),
|
|
122
|
+
lighthouseText(),
|
|
123
|
+
]);
|
|
124
|
+
// Ahrefs' licence requires its credit beside a Domain Rating.
|
|
125
|
+
const credit = ahrefsCredit();
|
|
126
|
+
const authority = lines("Authority", () => [
|
|
127
|
+
authorityText() && {
|
|
128
|
+
html: `${esc(authorityText())}${credit ? ` · ${link(credit.url, esc(credit.text))}` : ""}`,
|
|
129
|
+
md: `${noteMd(authorityText())}${credit ? ` · ${mdLink(credit.url, noteMd(credit.text))}` : ""}`,
|
|
130
|
+
},
|
|
131
|
+
]);
|
|
132
|
+
// Score views are labelled as estimates. Like every topic panel, they and the rank grid sit a heading level down in
|
|
133
|
+
// the Markdown.
|
|
134
|
+
const ESTIMATES = "Estimates, not part of the score";
|
|
135
|
+
/** @type {[() => string, () => string[]]} */
|
|
136
|
+
const views = [
|
|
137
|
+
() =>
|
|
138
|
+
viewsHtml().replace(
|
|
139
|
+
'<span class="sub">The audit read another way</span>',
|
|
140
|
+
`<span class="sub">${ESTIMATES}</span>`,
|
|
141
|
+
),
|
|
142
|
+
() => {
|
|
143
|
+
const v = viewsMd();
|
|
144
|
+
return v.length ? ["### Score views", "", `${ESTIMATES}.`, "", ...v.slice(2)] : [];
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
/** @type {[() => string, () => string[]]} */
|
|
148
|
+
const grid = [geoGridHtml, () => deeper(geoGridMd(), 1)];
|
|
34
149
|
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
]
|
|
55
|
-
|
|
56
|
-
|
|
150
|
+
// [tab, card, panel] rows. Panels that share a card render as one box. "since", "limits" and "findings" add to
|
|
151
|
+
// those existing tabs.
|
|
152
|
+
const [S, SP, L, SC] = ["search-ai", "speed", "links", "site-content"];
|
|
153
|
+
const SPEED = m.lighthouse.length ? "Speed and Lighthouse" : "Speed"; // the card names Lighthouse only when it ran
|
|
154
|
+
const tabs = byTab([
|
|
155
|
+
[S, "Search traffic", searchGlance],
|
|
156
|
+
[S, "Search traffic", () => topSearchesPanel(m)],
|
|
157
|
+
[S, "Search traffic", () => brandTrendPanel(m)],
|
|
158
|
+
[S, "Search traffic", () => indexVerdictPanel(m)],
|
|
159
|
+
[S, "Search traffic", newSearches],
|
|
160
|
+
[S, "Search traffic", connections],
|
|
161
|
+
[S, "Search traffic", posts],
|
|
162
|
+
[S, "Search ideas", () => keywordIdeasPanel(m)],
|
|
163
|
+
[S, "Search ideas", () => keywordDataPanel(m)],
|
|
164
|
+
[S, "Search ideas", queryGaps],
|
|
165
|
+
[S, "AI crawlers, agents and answers", aiCrawlers],
|
|
166
|
+
[S, "AI crawlers, agents and answers", agents],
|
|
167
|
+
[S, "AI crawlers, agents and answers", () => logsPanel(m)],
|
|
168
|
+
[S, "AI crawlers, agents and answers", aiAnswers],
|
|
169
|
+
[SP, SPEED, speedGlance],
|
|
170
|
+
[SP, SPEED, lighthouseDetail],
|
|
171
|
+
[SP, SPEED, speedDetails],
|
|
172
|
+
[SP, SPEED, images],
|
|
173
|
+
[L, "Internal links", linkStrength],
|
|
174
|
+
[L, "Internal links", linkedOnce],
|
|
175
|
+
[L, "Internal links", linkIdeas],
|
|
176
|
+
[L, "Links from other sites", authority],
|
|
177
|
+
[L, "Links from other sites", links],
|
|
178
|
+
[L, "Links from other sites", moreLinks],
|
|
179
|
+
[L, "Links to other sites", outLinks],
|
|
180
|
+
[SC, null, views],
|
|
181
|
+
[SC, "Structured data", () => schemaInventoryPanel(m)],
|
|
182
|
+
[SC, "Local business", local],
|
|
183
|
+
[SC, "Local business", grid],
|
|
184
|
+
[SC, "Content and writing", writing],
|
|
185
|
+
[SC, "Content and writing", descriptions],
|
|
186
|
+
[SC, "Content and writing", audience],
|
|
187
|
+
[SC, "Content and writing", productData],
|
|
188
|
+
[SC, "Content and writing", pageScores],
|
|
189
|
+
[SC, "Site hygiene", crawlCoverage],
|
|
190
|
+
[SC, "Site hygiene", browser],
|
|
191
|
+
[SC, "Site hygiene", hstsPreload],
|
|
192
|
+
[SC, "Site hygiene", appsPdfs],
|
|
193
|
+
[SC, "Site hygiene", a11y],
|
|
194
|
+
["since", "Over time", timeline],
|
|
195
|
+
["since", "Over time", changeCheck],
|
|
196
|
+
["limits", "Check settings", checkSettingsPanel],
|
|
197
|
+
["findings", "Checking a fix yourself", recheckNote],
|
|
198
|
+
]);
|
|
199
|
+
// The topic tabs that have something to show, in this order.
|
|
200
|
+
const topics = /** @type {[string, string][]} */ ([
|
|
201
|
+
[S, "Search & AI"],
|
|
202
|
+
[SP, "Speed"],
|
|
203
|
+
[L, "Links"],
|
|
204
|
+
[SC, "Site & content"],
|
|
205
|
+
]).filter(([id]) => tabs[id]);
|
|
57
206
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
207
|
+
const html = pageHtml(m, {
|
|
208
|
+
plan,
|
|
209
|
+
diff,
|
|
210
|
+
diffHtml,
|
|
211
|
+
trafficFor,
|
|
212
|
+
findingsHtml,
|
|
213
|
+
decisionsHtml,
|
|
214
|
+
decisionCount,
|
|
215
|
+
changesHtml,
|
|
216
|
+
passedHtml,
|
|
217
|
+
limitsHtml,
|
|
218
|
+
topics,
|
|
219
|
+
tabs,
|
|
220
|
+
overviewHtml: () => overviewHtml(m),
|
|
221
|
+
});
|
|
222
|
+
const md = mdFile
|
|
223
|
+
? markdown(m, {
|
|
224
|
+
plan,
|
|
225
|
+
diff,
|
|
226
|
+
topics,
|
|
227
|
+
tabs,
|
|
228
|
+
burstMd,
|
|
229
|
+
googleUpdatesText,
|
|
230
|
+
googlePostsText,
|
|
231
|
+
diffSections,
|
|
232
|
+
diffText,
|
|
233
|
+
unknownLines,
|
|
234
|
+
linksDroppedMd,
|
|
235
|
+
trafficOf,
|
|
236
|
+
clarityOf,
|
|
237
|
+
})
|
|
238
|
+
: null;
|
|
239
|
+
const { overall, verdict, unlock, openBlockers, open, countSev, fixed, checkSettings } = m;
|
|
240
|
+
const receipt = [
|
|
241
|
+
overall ? `SEO health score: ${overall.value}/100 (${bandOf(overall.value)[1]}). ${verdict}.` : verdict,
|
|
242
|
+
unlock &&
|
|
243
|
+
`Fixing the ${openBlockers.length === 1 ? "blocker" : `${openBlockers.length} blockers`} raises it to ${unlock.value}/100 (${bandOf(unlock.value)[1]}).`,
|
|
244
|
+
`Open: ${open.length} (${SEV.map(s => `${countSev(s)} ${SEV_LABEL[s].toLowerCase()}`).join(", ")}) · fixed: ${fixed.length}${overall ? ` · rules passing: ${overall.passing} of ${overall.rules}` : ""}`,
|
|
245
|
+
settingRows().length &&
|
|
246
|
+
`Check settings (settings.json): ${settingsSummary()}. The score leaves turned-off checks out.`,
|
|
247
|
+
...checkSettings.warnings.map(w => `Settings warning: ${w}`),
|
|
248
|
+
].filter(Boolean);
|
|
249
|
+
return { html, md, receipt };
|
|
82
250
|
}
|
|
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
251
|
|
|
95
|
-
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (!
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
252
|
+
// Prints the page with its print styles: every tab in turn, findings open, light colours. The browser modules load
|
|
253
|
+
// only for --pdf.
|
|
254
|
+
async function printPdf(htmlPath, pdf) {
|
|
255
|
+
const [{ findBrowser }, { launchChrome }, { installedBrowser }, { pathToFileURL }] = await Promise.all([
|
|
256
|
+
import("./checks/render.mjs"),
|
|
257
|
+
import("./lib/cdp.mjs"),
|
|
258
|
+
import("./lib/settings-dir.mjs"),
|
|
259
|
+
import("node:url"),
|
|
260
|
+
]);
|
|
261
|
+
const browser = findBrowser() || installedBrowser();
|
|
262
|
+
if (!browser)
|
|
263
|
+
throw new Error(
|
|
264
|
+
"no Chrome or Edge found, so no PDF was made (the HTML report is ready). Install Chrome or Edge, or set CHROME_PATH to it; in a container or CI, the owner can add one with npx seo-supervisor --with-browser (it downloads Chrome).",
|
|
265
|
+
);
|
|
266
|
+
const chrome = await launchChrome(browser, { timeoutMs: 60000 });
|
|
267
|
+
try {
|
|
268
|
+
const page = await chrome.newPage();
|
|
269
|
+
await page.send("Page.enable");
|
|
270
|
+
const loaded = new Promise((ok, no) => {
|
|
271
|
+
page.on("Page.loadEventFired", ok);
|
|
272
|
+
setTimeout(
|
|
273
|
+
no,
|
|
274
|
+
60000,
|
|
275
|
+
new Error("the report didn't finish loading in Chrome within 60 s, so no PDF was made."),
|
|
276
|
+
).unref();
|
|
277
|
+
});
|
|
278
|
+
await page.send("Page.navigate", { url: pathToFileURL(htmlPath).href });
|
|
279
|
+
await loaded;
|
|
280
|
+
await page.send("Runtime.evaluate", { expression: "document.fonts.ready.then(() => true)", awaitPromise: true });
|
|
281
|
+
// Every collapsed panel opens, as a browser's own print does (beforeprint), so the PDF holds them all.
|
|
282
|
+
await page.send("Runtime.evaluate", {
|
|
283
|
+
expression: "document.querySelectorAll('details').forEach(d => { d.open = true; })",
|
|
284
|
+
});
|
|
285
|
+
const { data } = await page.send("Page.printToPDF", {
|
|
286
|
+
printBackground: true,
|
|
287
|
+
paperWidth: 8.27,
|
|
288
|
+
paperHeight: 11.69,
|
|
289
|
+
}); // A4, in inches
|
|
290
|
+
writeFileSync(pdf, Buffer.from(data, "base64"));
|
|
291
|
+
} finally {
|
|
292
|
+
await chrome.close();
|
|
110
293
|
}
|
|
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
294
|
}
|
|
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
295
|
|
|
136
|
-
//
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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("");
|
|
296
|
+
// Exits 0 when written, 1 when only the PDF failed, 2 on a usage error or an input that's missing or isn't JSON.
|
|
297
|
+
const USAGE =
|
|
298
|
+
"Usage: node render-report.mjs <audit.json|seo-crawl.json|content-scan.json> [--out report.html] [--md report.md] [--no-md] [--pdf]";
|
|
299
|
+
async function main(argv) {
|
|
300
|
+
// The input file is the one word that isn't an option, wherever it sits (--out x.html audit.json works too).
|
|
301
|
+
const args = parseArgs(argv, { flags: ["out", "md"], booleans: ["no-md", "pdf"], positionals: 1, usage: USAGE }),
|
|
302
|
+
inPath = args._[0];
|
|
303
|
+
if (!inPath || args.out === true || args.md === true) throw new Fail(USAGE);
|
|
304
|
+
const outPath = resolve(args.out || inPath.replace(/\.json$/i, "") + ".html");
|
|
305
|
+
const mdPath = args["no-md"] ? null : resolve(args.md || outPath.replace(/\.html?$/i, "") + ".md");
|
|
306
|
+
const text = readFileSync(inPath, "utf8");
|
|
307
|
+
let raw;
|
|
308
|
+
try {
|
|
309
|
+
raw = JSON.parse(text);
|
|
310
|
+
} catch (e) {
|
|
311
|
+
throw new Fail(`render-report: ${inPath} isn't valid JSON (${e.message}).`);
|
|
692
312
|
}
|
|
693
|
-
if (
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
313
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
314
|
+
throw new Fail(`render-report: ${inPath} isn't an audit: it should hold one JSON object (report-format.md).`);
|
|
315
|
+
const { html, md, receipt } = render(raw, {
|
|
316
|
+
dir: dirname(resolve(inPath)),
|
|
317
|
+
mdFile: mdPath ? basename(mdPath) : null,
|
|
318
|
+
});
|
|
319
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
320
|
+
writeFileSync(outPath, html);
|
|
321
|
+
if (mdPath) writeFileSync(mdPath, md);
|
|
322
|
+
const pdfPath = args.pdf ? outPath.replace(/\.html?$/i, "") + ".pdf" : null;
|
|
323
|
+
const pdfError = pdfPath
|
|
324
|
+
? await printPdf(outPath, pdfPath).then(
|
|
325
|
+
() => null,
|
|
326
|
+
e => e.message,
|
|
327
|
+
)
|
|
328
|
+
: null;
|
|
329
|
+
console.log(
|
|
330
|
+
[...receipt, `Wrote: ${[outPath, mdPath, pdfPath && !pdfError && pdfPath].filter(Boolean).join(", ")}`]
|
|
331
|
+
.filter(Boolean)
|
|
332
|
+
.join("\n"),
|
|
333
|
+
);
|
|
334
|
+
if (pdfError) {
|
|
335
|
+
console.error(`render-report: ${pdfError}`);
|
|
336
|
+
return 1;
|
|
698
337
|
}
|
|
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
338
|
}
|
|
702
339
|
|
|
703
|
-
|
|
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) : ""}`);
|
|
340
|
+
if (isMain(import.meta.url)) await runMain(() => main(process.argv.slice(2)));
|