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
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// The AI panels on the Search & AI tab: agent support, AI crawler access and the AI answer check.
|
|
3
|
+
import { esc, noteMd, notePath, num, obj, plural, isCount } from "../format.mjs";
|
|
4
|
+
|
|
5
|
+
export function aiPanels({ raw, lighthouse }) {
|
|
6
|
+
// AI agents (WebMCP tools, UCP, agent files), from the crawler.
|
|
7
|
+
const AGENT_FILE = {
|
|
8
|
+
"/.well-known/api-catalog": "API catalog (RFC 9727)",
|
|
9
|
+
"/.well-known/agent-card.json": "A2A agent card",
|
|
10
|
+
"/.well-known/oauth-protected-resource": "OAuth protected resource (RFC 9728)",
|
|
11
|
+
"/.well-known/oauth-authorization-server": "OAuth authorization server (RFC 8414)",
|
|
12
|
+
};
|
|
13
|
+
const agentRows = (() => {
|
|
14
|
+
const a = obj(raw.agents),
|
|
15
|
+
strs = x => (Array.isArray(x) ? x.filter(s => typeof s === "string" && s) : []);
|
|
16
|
+
if (!a) return [];
|
|
17
|
+
return [
|
|
18
|
+
...(Array.isArray(a.pages) ? a.pages.filter(p => obj(p) && strs(p.tools).length) : []).map(p => [
|
|
19
|
+
notePath(p.url),
|
|
20
|
+
`WebMCP tools: ${strs(p.tools).join(", ")}`,
|
|
21
|
+
]),
|
|
22
|
+
typeof a.ucp === "string" && a.ucp && ["/.well-known/ucp", `UCP shop profile, version ${a.ucp}`],
|
|
23
|
+
...strs(a.wellKnown).map(f => [f, AGENT_FILE[f] || "agent file"]),
|
|
24
|
+
].filter(Boolean);
|
|
25
|
+
})();
|
|
26
|
+
const AGENTS_INTRO =
|
|
27
|
+
"What the site offers AI agents, listed for information: none of it is a finding or changes the score. WebMCP is a Chrome experiment that lets a page offer tools to AI agents, and its API is still changing; only inline scripts and forms were read. UCP is the open standard behind checkout in Google's AI Mode and Gemini.";
|
|
28
|
+
const agents = () =>
|
|
29
|
+
agentRows.length && {
|
|
30
|
+
cls: "agents",
|
|
31
|
+
title: "AI agents",
|
|
32
|
+
blocks: [{ p: AGENTS_INTRO }, { rows: agentRows.map(([where, what]) => [{ code: where }, what]) }],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const AI_KIND = { search: "AI search", training: "Training", user: "Fetches for a user", other: "Other" };
|
|
36
|
+
const AI_STATUS = {
|
|
37
|
+
allowed: "Allowed",
|
|
38
|
+
blocked: "Blocked",
|
|
39
|
+
"blocked-by-star": "Blocked by `User-agent: *`",
|
|
40
|
+
"blocked-by-googlebot": "Blocked by the Googlebot group (Apple follows it when Applebot isn't named)",
|
|
41
|
+
};
|
|
42
|
+
// The shared AI-training opt-out; an unknown value shows nothing.
|
|
43
|
+
const TRAINING = {
|
|
44
|
+
"not-set": "not in robots.txt. A `User-agent: *` group doesn't cover it",
|
|
45
|
+
blocked: "set: it refuses AI training for the whole site",
|
|
46
|
+
partly: "set for some paths only",
|
|
47
|
+
allowed: "set, and it allows AI training",
|
|
48
|
+
};
|
|
49
|
+
const trainingLine = () =>
|
|
50
|
+
Object.hasOwn(TRAINING, raw.trainingOptOut)
|
|
51
|
+
? `Shared AI-training opt-out (\`User-agent: __usage_ai-training\`, an IETF draft): ${TRAINING[raw.trainingOptOut]}. Anthropic honours it since 30 Oct 2026, and Bing from 1 Feb 2027; Google plans to in 2027.`
|
|
52
|
+
: "";
|
|
53
|
+
const aiBots = (Array.isArray(raw.aiBots) ? raw.aiBots : []).filter(
|
|
54
|
+
b => obj(b) && typeof b.bot === "string" && Object.hasOwn(AI_STATUS, b.robots),
|
|
55
|
+
);
|
|
56
|
+
const noLandmarks = (l =>
|
|
57
|
+
l && [l.checked, l.count].every(isCount) && Array.isArray(l.pages)
|
|
58
|
+
? { ...l, pages: l.pages.filter(p => obj(p) && typeof p.url === "string" && Array.isArray(p.missing)) }
|
|
59
|
+
: null)(obj(raw.landmarks));
|
|
60
|
+
const agentic = lighthouse
|
|
61
|
+
.filter(x => obj(x.agentic) && [x.agentic.passed, x.agentic.total].every(isCount))
|
|
62
|
+
.map(x => ({
|
|
63
|
+
path: notePath(x.url),
|
|
64
|
+
passed: x.agentic.passed,
|
|
65
|
+
total: x.agentic.total,
|
|
66
|
+
failed: (Array.isArray(x.agentic.failed) ? x.agentic.failed : []).filter(
|
|
67
|
+
f => obj(f) && typeof f.title === "string",
|
|
68
|
+
),
|
|
69
|
+
}));
|
|
70
|
+
const AI_INTRO =
|
|
71
|
+
"Information only: none of this changes the score. The table shows whether robots.txt lets each AI crawler in, by its own group or, when it has none, by the User-agent: * group. Fetchers for a user get a page a person asked for, and some vendors say robots.txt may not apply to them.";
|
|
72
|
+
const AGENTIC_INTRO =
|
|
73
|
+
"Lighthouse's Agentic browsing checks (experimental; Lighthouse 13.3 or later with Chrome 150 or later): whether AI agents can read and use the page. There's no 0–100 score, only the checks passed.";
|
|
74
|
+
const aiBotStatus = b => AI_STATUS[b.robots] + (b.mayIgnore ? " (may ignore robots.txt)" : "");
|
|
75
|
+
const landmarkLine = () =>
|
|
76
|
+
`${num(noLandmarks.count)} of ${num(noLandmarks.checked)} pages lack one or more landmarks (main, nav, header, footer), which screen readers and AI agents use to find their way around a page (AI-05).`;
|
|
77
|
+
const agenticRow = a =>
|
|
78
|
+
`${num(a.passed)} of ${num(a.total)} checks passed${a.failed.length ? `; failing: ${a.failed.map(f => f.title).join("; ")}` : ""}`;
|
|
79
|
+
const aiCrawlersOn = () => aiBots.length || noLandmarks || agentic.length || trainingLine() || aiExtrasOn();
|
|
80
|
+
// Local sentences with `code` in them are { inl }. AI_INTRO's "User-agent: *" and the bot names go into the Markdown
|
|
81
|
+
// with the * unescaped, as it can't start emphasis there.
|
|
82
|
+
const aiCrawlers = () =>
|
|
83
|
+
aiCrawlersOn() && {
|
|
84
|
+
cls: "aibots",
|
|
85
|
+
title: "AI crawlers and agents",
|
|
86
|
+
blocks: [
|
|
87
|
+
aiBots.length && { p: { html: esc(AI_INTRO), md: AI_INTRO } },
|
|
88
|
+
aiBots.length && {
|
|
89
|
+
head: ["Crawler", "Vendor", "Kind", "robots.txt"],
|
|
90
|
+
align: ["---", "---", "---", "---"],
|
|
91
|
+
rows: aiBots.map(b => [
|
|
92
|
+
{ html: `<code>${esc(b.bot)}</code>`, md: noteMd(b.bot) },
|
|
93
|
+
b.vendor,
|
|
94
|
+
AI_KIND[b.kind] || b.kind,
|
|
95
|
+
{ inl: aiBotStatus(b) },
|
|
96
|
+
]),
|
|
97
|
+
},
|
|
98
|
+
trainingLine() && { p: { inl: trainingLine() } },
|
|
99
|
+
aiBots.length && { p: { inl: BRAVE_LINE } },
|
|
100
|
+
botSync && { p: { inl: SYNC_LINE } },
|
|
101
|
+
contentUsage.length && { p: USAGE_INTRO },
|
|
102
|
+
{
|
|
103
|
+
rows: contentUsage.map(u => [
|
|
104
|
+
typeof u.agents === "string"
|
|
105
|
+
? { code: `User-agent: ${u.agents}` }
|
|
106
|
+
: "No group (above the first User-agent line)",
|
|
107
|
+
{ code: `Content-Usage: ${u.rule}` },
|
|
108
|
+
": ",
|
|
109
|
+
]),
|
|
110
|
+
},
|
|
111
|
+
paidPages.length && { p: PAID_INTRO },
|
|
112
|
+
{ rows: paidPages.map(p => [{ code: notePath(p.url) }, paidRow(p)]) },
|
|
113
|
+
noLandmarks && { p: landmarkLine() },
|
|
114
|
+
noLandmarks && { rows: noLandmarks.pages.map(p => [{ code: notePath(p.url) }, `no ${p.missing.join(", ")}`]) },
|
|
115
|
+
agentic.length && { p: AGENTIC_INTRO },
|
|
116
|
+
{ rows: agentic.map(a => [{ code: a.path }, agenticRow(a)]) },
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
// Shown inside the "AI crawlers and agents" panel. Brave falls back to Googlebot's rules, and aiBotPaid lists pages
|
|
120
|
+
// that answered the AI probe with a 402, as Cloudflare's pay per crawl does. Crawled text is escaped.
|
|
121
|
+
// https://search.brave.com/help/brave-search-crawler
|
|
122
|
+
const contentUsage = (Array.isArray(raw.contentUsage) ? raw.contentUsage : [])
|
|
123
|
+
.filter(u => obj(u) && typeof u.rule === "string")
|
|
124
|
+
.slice(0, 20);
|
|
125
|
+
const paidPages = (Array.isArray(raw.aiBotPaid) ? raw.aiBotPaid : [])
|
|
126
|
+
.filter(p => obj(p) && typeof p.url === "string" && typeof p.bot === "string")
|
|
127
|
+
.slice(0, 20);
|
|
128
|
+
const botSync = raw.botPreferenceSync === true;
|
|
129
|
+
const BRAVE_LINE =
|
|
130
|
+
"Brave Search's crawler has no user agent of its own, so robots.txt can't name it, and it won't crawl a page Googlebot can't. Brave says robots.txt doesn't keep a page out of its results: a `noindex` robots meta tag does.";
|
|
131
|
+
// Cloudflare marks its block either way.
|
|
132
|
+
// https://developers.cloudflare.com/bots/additional-configurations/managed-robots-txt/
|
|
133
|
+
// https://blog.cloudflare.com/bot-preference-sync/
|
|
134
|
+
const SYNC_LINE =
|
|
135
|
+
"This robots.txt has a block that Cloudflare adds, marked `# BEGIN Cloudflare Managed content` or `# BEGIN Cloudflare Bot Preference Sync`. Cloudflare's managed robots.txt and its Bot Preference Sync (announced 21 Aug 2026) write the AI crawler choices made in Cloudflare's dashboard into the live robots.txt, in front of the site's own lines. So the robots.txt the site serves can differ from the one in the code: change those crawlers in Cloudflare's dashboard, as editing the file in the code won't change that block.";
|
|
136
|
+
const USAGE_INTRO =
|
|
137
|
+
"Content-Usage lines in robots.txt, shown as written. They come from the IETF's AI preferences drafts (August and September 2026), which aren't final, so the crawl doesn't judge them.";
|
|
138
|
+
const PAID_INTRO =
|
|
139
|
+
"Asked as an AI search crawler, these pages answered 402 Payment Required: the site asks crawlers to pay for the page. Cloudflare's pay per crawl answers this way, with the price in a crawler-price header. That's paid access, not a refusal, so it isn't a finding.";
|
|
140
|
+
const paidRow = p => `${p.bot}${typeof p.price === "string" ? ` · crawler-price: ${p.price}` : ""}`;
|
|
141
|
+
const aiExtrasOn = () => contentUsage.length || paidPages.length || botSync;
|
|
142
|
+
// aiAnswers comes from ai-answers.json: per engine, how many sampled answers cited the site and each rival. It's a
|
|
143
|
+
// count from a small sample, so never a score or a finding. Questions, rivals, pages and errors are user or provider
|
|
144
|
+
// text, so they're escaped.
|
|
145
|
+
const answers = (a => {
|
|
146
|
+
const cnt = x => (Number.isInteger(x) && x >= 0 ? x : null),
|
|
147
|
+
strs = x => (Array.isArray(x) ? x.filter(s => typeof s === "string") : []);
|
|
148
|
+
const counts = m => Object.entries(obj(m) || {}).filter(([, v]) => cnt(v) !== null);
|
|
149
|
+
const engines = Object.values(obj(a?.engines) || {})
|
|
150
|
+
.map(obj)
|
|
151
|
+
.filter(
|
|
152
|
+
e =>
|
|
153
|
+
e &&
|
|
154
|
+
typeof e.name === "string" &&
|
|
155
|
+
cnt(e.answers) !== null &&
|
|
156
|
+
cnt(e.cited) !== null &&
|
|
157
|
+
(e.answers > 0 || typeof e.error === "string"),
|
|
158
|
+
);
|
|
159
|
+
return engines.length
|
|
160
|
+
? {
|
|
161
|
+
date: /^\d{4}-\d{2}-\d{2}$/.test(a.date) ? a.date : "an unknown date",
|
|
162
|
+
questions: strs(a.questions).length,
|
|
163
|
+
repeat: cnt(a.repeat) || 1,
|
|
164
|
+
engines: engines.map(e => ({
|
|
165
|
+
...e,
|
|
166
|
+
rivals: counts(e.rivals),
|
|
167
|
+
pages: counts(e.pages),
|
|
168
|
+
never: strs(e.neverCited),
|
|
169
|
+
})),
|
|
170
|
+
}
|
|
171
|
+
: null;
|
|
172
|
+
})(obj(raw.aiAnswers));
|
|
173
|
+
const ANSWERS_INTRO =
|
|
174
|
+
"Whether AI answer engines cited your site when they answered the questions you chose, asked through each provider's API with your own keys. These answers can differ from what people see in the ChatGPT or Perplexity apps, which add personal settings and location, and answers change from day to day. So this is a sample to compare over time, not a ranking. Information only: it doesn't change the score.";
|
|
175
|
+
const engineName = e => `${e.name}${typeof e.model === "string" ? ` (${e.model})` : ""}`;
|
|
176
|
+
const answersHead = e =>
|
|
177
|
+
`your site was cited in ${e.cited} of ${plural(e.answers, "answer")} (a sample: ${plural(answers.questions, "question")}, asked ${answers.repeat === 1 ? "once" : `${answers.repeat} times`} each, on ${answers.date}).`;
|
|
178
|
+
const answersStop = e =>
|
|
179
|
+
typeof e.error === "string" ? `${e.name} stopped after ${plural(e.answers, "answer")}: ${e.error}` : "";
|
|
180
|
+
const citedIn = n => `cited in ${plural(n, "answer")}`;
|
|
181
|
+
const answersLists = e =>
|
|
182
|
+
[
|
|
183
|
+
["Rivals", e.rivals.map(([d, n]) => [d, `cited in ${n} of ${plural(e.answers, "answer")}`])],
|
|
184
|
+
["Your pages cited", e.pages.map(([p, n]) => [{ code: p }, citedIn(n)])],
|
|
185
|
+
["Questions whose answers never cited your site", e.never.map(q => [q])],
|
|
186
|
+
].filter(([, rows]) => rows.length);
|
|
187
|
+
// Per engine: one line on the page; in the Markdown, a ### heading with the line and why it stopped.
|
|
188
|
+
const engineHead = e => ({
|
|
189
|
+
html: `<p><b>${esc(engineName(e))}</b>: ${esc(answersHead(e))}${answersStop(e) ? ` ${esc(answersStop(e))}` : ""}</p>`,
|
|
190
|
+
md: [
|
|
191
|
+
`### ${noteMd(e.name)}`,
|
|
192
|
+
"",
|
|
193
|
+
noteMd(`${engineName(e)}: ${answersHead(e)}`),
|
|
194
|
+
"",
|
|
195
|
+
...(answersStop(e) ? [noteMd(answersStop(e)), ""] : []),
|
|
196
|
+
],
|
|
197
|
+
});
|
|
198
|
+
const aiAnswers = () =>
|
|
199
|
+
answers && {
|
|
200
|
+
cls: "aianswers",
|
|
201
|
+
title: "AI answer check",
|
|
202
|
+
blocks: [
|
|
203
|
+
{ p: ANSWERS_INTRO },
|
|
204
|
+
...answers.engines.flatMap(e => [
|
|
205
|
+
engineHead(e),
|
|
206
|
+
...answersLists(e).flatMap(([t, rows]) => [{ p: `${t}:` }, { rows }]),
|
|
207
|
+
]),
|
|
208
|
+
],
|
|
209
|
+
};
|
|
210
|
+
return { agents, aiCrawlers, aiAnswers };
|
|
211
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// Panels from connected services: their reports, the change check and the new searches.
|
|
3
|
+
import { fmtDate, num, obj, plural, isCount, isText } from "../format.mjs";
|
|
4
|
+
import { isoDates } from "../traffic.mjs";
|
|
5
|
+
import { periodOf } from "../sources.mjs";
|
|
6
|
+
|
|
7
|
+
export function connectionPanels({ raw }) {
|
|
8
|
+
const bing = obj(raw.bing),
|
|
9
|
+
matomo = obj(raw.matomo),
|
|
10
|
+
posthog = obj(raw.posthog);
|
|
11
|
+
// Third-party text (registrars, video titles, referrers, paths) is escaped by the callers.
|
|
12
|
+
const connLines = () => {
|
|
13
|
+
const n = x => Number(x) || 0,
|
|
14
|
+
fin = Number.isFinite,
|
|
15
|
+
arr = x => (Array.isArray(x) ? x.filter(obj) : []),
|
|
16
|
+
isDay = s => /^\d{4}-\d{2}-\d{2}$/.test(s);
|
|
17
|
+
const top = (map, k, max = 10, label = s => s) =>
|
|
18
|
+
Object.entries(obj(map) || {})
|
|
19
|
+
.map(([name, v]) => /** @type {[string, number]} */ ([name, n(v?.[k])]))
|
|
20
|
+
.filter(([, v]) => v > 0)
|
|
21
|
+
.sort((a, b) => b[1] - a[1])
|
|
22
|
+
.slice(0, max)
|
|
23
|
+
.map(([name, v]) => `${label(name)} ${num(v)}`)
|
|
24
|
+
.join(" · ");
|
|
25
|
+
const when = x => (isoDates(x) ? ` (${isoDates(x)})` : "");
|
|
26
|
+
const ages = arr(raw.domainAge).filter(d => typeof d.domain === "string" && isDay(d.registered));
|
|
27
|
+
const moz = arr(raw.moz).filter(m => typeof m.domain === "string" && fin(m.domainAuthority));
|
|
28
|
+
const yt = obj(raw.youtube),
|
|
29
|
+
ch = obj(yt?.channel),
|
|
30
|
+
st = obj(raw.siteTotals),
|
|
31
|
+
ad = obj(raw.analyticsDetail),
|
|
32
|
+
ai = obj(ad?.aiAssistant);
|
|
33
|
+
const sister = obj(bing?.sister),
|
|
34
|
+
others = Array.isArray(sister?.onlySister) ? sister.onlySister.filter(h => typeof h === "string" && h) : [];
|
|
35
|
+
const sisterHost = (() => {
|
|
36
|
+
try {
|
|
37
|
+
return new URL(sister.site).hostname;
|
|
38
|
+
} catch {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
const report = (x, k, what, on) => {
|
|
43
|
+
const r = obj(x),
|
|
44
|
+
pages = Object.keys(obj(r?.pages) || {}).length;
|
|
45
|
+
return (
|
|
46
|
+
r &&
|
|
47
|
+
n(r[k]) > 0 &&
|
|
48
|
+
`${what}: ${plural(n(r[k]), k.slice(0, -1))} ${on} ${plural(pages, "page")}${pages ? ` (top: ${top(r.pages, k, 3)})` : ""}`
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
return [
|
|
52
|
+
ages.length &&
|
|
53
|
+
`Domain age (RDAP): ${ages.map(d => `${d.domain} registered ${d.registered}${typeof d.registrar === "string" && d.registrar ? ` (${d.registrar})` : ""}`).join(" · ")}`,
|
|
54
|
+
moz.length &&
|
|
55
|
+
`Moz: ${moz.map(m => [`${m.domain} Domain Authority ${m.domainAuthority}`, fin(m.spamScore) && `Spam Score ${m.spamScore}`, fin(m.linkingDomains) && plural(m.linkingDomains, "linking domain")].filter(Boolean).join(", ")).join(" · ")}`,
|
|
56
|
+
ch &&
|
|
57
|
+
typeof ch.title === "string" &&
|
|
58
|
+
`YouTube channel ${ch.title}: ${[fin(ch.subscribers) && plural(ch.subscribers, "subscriber"), fin(ch.videos) && plural(ch.videos, "video"), fin(ch.views) && plural(ch.views, "view")].filter(Boolean).join(" · ")}`,
|
|
59
|
+
...arr(yt?.topics)
|
|
60
|
+
.filter(t => typeof t.topic === "string" && arr(t.videos).length)
|
|
61
|
+
.map(t => {
|
|
62
|
+
const v = arr(t.videos);
|
|
63
|
+
return `Top YouTube videos for “${t.topic}”: ${ch ? `${v.filter(x => x.own === true).length} of ${v.length} from your channel · ` : ""}first: ${v[0].title}${v[0].channel ? ` (${v[0].channel})` : ""}`;
|
|
64
|
+
}),
|
|
65
|
+
st &&
|
|
66
|
+
n(st.clicks) > 0 &&
|
|
67
|
+
`Search Console totals for the whole property: ${plural(n(st.clicks), "click")} · ${plural(n(st.impressions), "impression")}. ${st.complete === false ? `The queries listed cover ${Math.round((100 * n(st.queryClicks)) / n(st.clicks))}% of the clicks; Google doesn't list rare queries.` : st.complete ? "The queries listed cover every click." : ""}`.trim(),
|
|
68
|
+
ad &&
|
|
69
|
+
n(ad.sessions) > 0 &&
|
|
70
|
+
`Google Analytics organic: ${plural(n(ad.sessions), "session")}${n(ad.users) ? ` from ${plural(n(ad.users), "user")}` : ""}${top(ad.byDevice, "sessions") ? ` · ${top(ad.byDevice, "sessions")}` : ""}${periodOf(raw, "analyticsDetail") ? ` (${String(periodOf(raw, "analyticsDetail")).toLowerCase()})` : ""}`,
|
|
71
|
+
ad &&
|
|
72
|
+
top(ad.byCountry, "sessions") &&
|
|
73
|
+
`Google Analytics organic sessions by country: ${top(ad.byCountry, "sessions")}`,
|
|
74
|
+
ai &&
|
|
75
|
+
n(ai.sessions) > 0 &&
|
|
76
|
+
`Google Analytics AI Assistant channel: ${plural(n(ai.sessions), "session")}${top(ai.bySource, "sessions") ? ` (${top(ai.bySource, "sessions")})` : ""}`,
|
|
77
|
+
top(matomo?.byChannel, "visits") && `Matomo visits by channel: ${top(matomo.byChannel, "visits")}${when(matomo)}`,
|
|
78
|
+
top(matomo?.byEngine, "visits") &&
|
|
79
|
+
`Matomo search visits by search engine: ${top(matomo.byEngine, "visits")}${when(matomo)}`,
|
|
80
|
+
top(posthog?.byReferrer, "visits") &&
|
|
81
|
+
`PostHog visits by referrer: ${top(posthog.byReferrer, "visits", 10, k => (k === "$direct" ? "direct" : k))}${when(posthog)}`,
|
|
82
|
+
posthog?.referrersCaptured === false &&
|
|
83
|
+
"PostHog: no visit in this period has a referrer, so it can't tell visits from search apart. Its zero visits from search may be wrong.",
|
|
84
|
+
report(raw.aiReports?.google, "impressions", "Google AI Overviews and AI Mode", "on"),
|
|
85
|
+
report(raw.aiReports?.bing, "citations", "Bing AI answers", "of"),
|
|
86
|
+
others.length &&
|
|
87
|
+
sisterHost &&
|
|
88
|
+
`Bing: ${plural(others.length, "site")} ${others.length === 1 ? "links" : "link"} to ${sisterHost} but not to this site: ${others.slice(0, 10).join(", ")}${others.length > 10 ? ` and ${others.length - 10} more` : ""}`,
|
|
89
|
+
].filter(Boolean);
|
|
90
|
+
};
|
|
91
|
+
const connections = () => {
|
|
92
|
+
const l = connLines();
|
|
93
|
+
return l.length && { cls: "conn", title: "From your connections", blocks: l.map(t => ({ quiet: t })) };
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// changeCheck, from change-check.mjs: one clicks line, never offered as a cause. Numbers are validated; the callers
|
|
97
|
+
// escape text.
|
|
98
|
+
const changeLine = () => {
|
|
99
|
+
const c = obj(raw.changeCheck),
|
|
100
|
+
m = obj(c?.clicks),
|
|
101
|
+
g = obj(c?.groups),
|
|
102
|
+
int = Number.isInteger;
|
|
103
|
+
const ranged = m && [m.percent, m.low, m.high].every(int);
|
|
104
|
+
if (
|
|
105
|
+
!c ||
|
|
106
|
+
!/^\d{4}-\d{2}-\d{2}$/.test(c.changeDate) ||
|
|
107
|
+
!["likely up", "likely down", "inconclusive"].includes(m?.verdict) ||
|
|
108
|
+
(!ranged && m.verdict !== "inconclusive")
|
|
109
|
+
)
|
|
110
|
+
return "";
|
|
111
|
+
const signed = p => `${p > 0 ? "+" : p < 0 ? "−" : ""}${num(Math.abs(p))}%`,
|
|
112
|
+
changed = obj(g?.changed)?.pages,
|
|
113
|
+
control = obj(g?.control)?.pages;
|
|
114
|
+
const when = fmtDate(c.changeDate);
|
|
115
|
+
const what = ranged
|
|
116
|
+
? `${m.verdict}, about ${signed(m.percent)} compared with ${isCount(control) ? plural(control, "similar unchanged page") : "similar unchanged pages"} (likely range ${signed(m.low)} to ${signed(m.high)}${m.verdict === "inconclusive" ? ", which includes no change" : ""})`
|
|
117
|
+
: `inconclusive${isText(m.reason) ? `, ${m.reason}` : ""}`;
|
|
118
|
+
return `Change check, ${isCount(changed) ? plural(changed, "page") : "the pages"} changed on ${when}${isCount(c.days) ? `, ${c.days} days before and after` : ""}: Google Search clicks ${what}. This shows what happened to the numbers, not why. Information only.`;
|
|
119
|
+
};
|
|
120
|
+
const changeCheck = () => {
|
|
121
|
+
const l = changeLine();
|
|
122
|
+
return l && { title: "Change check", blocks: [{ quiet: l }] };
|
|
123
|
+
};
|
|
124
|
+
// newQueries: searches with no row in the previous period, the first 10 as given (most impressions first). Search
|
|
125
|
+
// text is third-party, escaped where shown.
|
|
126
|
+
const newSearchLine = () => {
|
|
127
|
+
const q = (Array.isArray(raw.newQueries) ? raw.newQueries : [])
|
|
128
|
+
.filter(x => obj(x) && typeof x.query === "string" && x.query && Number.isFinite(x.impressions))
|
|
129
|
+
.slice(0, 10);
|
|
130
|
+
return q.length
|
|
131
|
+
? `New searches this period, with no impressions in the period before: ${q.map(x => `${x.query} (${num(x.impressions)} impressions)`).join(" · ")}. Google hides searches very few people make, so a few of these may have shown the site before. Information only.`
|
|
132
|
+
: "";
|
|
133
|
+
};
|
|
134
|
+
const newSearches = () => {
|
|
135
|
+
const l = newSearchLine();
|
|
136
|
+
return l && { title: "New searches", blocks: [{ quiet: l }] };
|
|
137
|
+
};
|
|
138
|
+
return { connections, changeCheck, newSearches };
|
|
139
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// The content panels on the Site & content tab.
|
|
3
|
+
import { esc, noteMd, notePath, num, obj, plural, isCount, isText } from "../format.mjs";
|
|
4
|
+
import { listedIn } from "../panel.mjs";
|
|
5
|
+
|
|
6
|
+
export function contentPanels({ raw, mdFile }) {
|
|
7
|
+
// Writing notes quote crawled sentences and URLs, so they're escaped.
|
|
8
|
+
const writingNotes = (Array.isArray(raw.writingNotes) ? raw.writingNotes : []).filter(
|
|
9
|
+
n => obj(n) && typeof n.url === "string",
|
|
10
|
+
);
|
|
11
|
+
const noteText = n => {
|
|
12
|
+
const k = x => Math.max(0, Math.floor(Number(x) || 0)),
|
|
13
|
+
stock = Array.isArray(n.stockPhrases) ? n.stockPhrases.filter(s => typeof s === "string") : [];
|
|
14
|
+
return [
|
|
15
|
+
k(n.longSentences) && `${plural(k(n.longSentences), "sentence")} over 35 words`,
|
|
16
|
+
k(n.longParagraphs) && `${plural(k(n.longParagraphs), "paragraph")} over 150 words`,
|
|
17
|
+
stock.length && `stock phrases: ${stock.map(s => `“${s}”`).join(", ")}`,
|
|
18
|
+
Number.isFinite(n.readingEase) && `reading ease ${n.readingEase}`,
|
|
19
|
+
typeof n.longestSentence === "string" && n.longestSentence && `longest sentence: “${n.longestSentence}”`,
|
|
20
|
+
]
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.join(" · ");
|
|
23
|
+
};
|
|
24
|
+
const WRITING_INTRO =
|
|
25
|
+
"Long sentences, long paragraphs and stock phrases on English pages, with Flesch reading ease (0 to 100, higher is easier) as a rough guide. Code and tables are left out. These notes help the writing; they never change the score.";
|
|
26
|
+
const writing = () =>
|
|
27
|
+
writingNotes.length && {
|
|
28
|
+
cls: "writing",
|
|
29
|
+
title: "Writing notes",
|
|
30
|
+
blocks: [
|
|
31
|
+
{ p: WRITING_INTRO },
|
|
32
|
+
{ rows: writingNotes.map(n => [{ code: notePath(n.url) }, noteText(n)]), cap: 10 },
|
|
33
|
+
writingNotes.length > 10 && listedIn(writingNotes.length, mdFile),
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// How many Products give each recommended merchant listing field. Numbers only, so nothing crawled is shown.
|
|
38
|
+
const productFields = obj(raw.productFields),
|
|
39
|
+
PRODUCT_FIELDS = [
|
|
40
|
+
["brand", "a brand"],
|
|
41
|
+
["gtin", "a GTIN or MPN"],
|
|
42
|
+
["sku", "a SKU"],
|
|
43
|
+
["color", "a colour"],
|
|
44
|
+
["size", "a size"],
|
|
45
|
+
["material", "a material"],
|
|
46
|
+
["category", "a category"],
|
|
47
|
+
];
|
|
48
|
+
const productLine =
|
|
49
|
+
productFields &&
|
|
50
|
+
isCount(productFields.products) &&
|
|
51
|
+
productFields.products > 0 &&
|
|
52
|
+
PRODUCT_FIELDS.every(([k]) => isCount(productFields[k]))
|
|
53
|
+
? `Of ${plural(productFields.products, "product")} in the schema: ${PRODUCT_FIELDS.map(([k, w]) => `${num(productFields[k])} with ${w}`).join(", ")}. Google recommends each one where the product has it, so a GTIN, colour or material can rightly be missing. Information only: it doesn't change the score.`
|
|
54
|
+
: "";
|
|
55
|
+
const productData = () => productLine && { title: "Product data", blocks: [{ quiet: productLine }] };
|
|
56
|
+
|
|
57
|
+
// Templated descriptions (META-02) and keyword use on English pages (CONTENT-03). Crawled text is escaped.
|
|
58
|
+
const tdShare = (t =>
|
|
59
|
+
t && Number.isInteger(t.pages) && Number.isInteger(t.templated) && t.templated > 0 && t.pages >= t.templated
|
|
60
|
+
? t
|
|
61
|
+
: null)(obj(raw.templatedDescriptions));
|
|
62
|
+
const tdClusters =
|
|
63
|
+
tdShare && Array.isArray(tdShare.clusters)
|
|
64
|
+
? tdShare.clusters.filter(
|
|
65
|
+
c => obj(c) && typeof c.section === "string" && Number.isInteger(c.templated) && Number.isInteger(c.pages),
|
|
66
|
+
)
|
|
67
|
+
: [];
|
|
68
|
+
// The verdict is a local sentence, so it's written as is.
|
|
69
|
+
const asIs = s => ({ html: s, md: s });
|
|
70
|
+
const tdText = () => [
|
|
71
|
+
`${num(tdShare.templated)} of ${plural(tdShare.pages, "description")} (${Math.round((100 * tdShare.templated) / tdShare.pages)}%) end in a stock call to action or in a last sentence other pages share. `,
|
|
72
|
+
tdShare.verdict === "cluster" && tdClusters.length
|
|
73
|
+
? [
|
|
74
|
+
asIs("Verdict: a cluster. Most are in "),
|
|
75
|
+
tdClusters.map((c, i) => [i ? ", " : "", { code: c.section }, ` (${c.templated} of ${c.pages} pages)`]),
|
|
76
|
+
asIs(", so that section's template is the fix."),
|
|
77
|
+
]
|
|
78
|
+
: asIs(
|
|
79
|
+
tdShare.verdict === "site-wide"
|
|
80
|
+
? "Verdict: site-wide. Half or more of the descriptions are templated, so the shared description template is the fix."
|
|
81
|
+
: "Verdict: scattered. Fix them page by page.",
|
|
82
|
+
),
|
|
83
|
+
];
|
|
84
|
+
const KW = ["natural", "missing", "repetitive", "forced"];
|
|
85
|
+
const KW_WHY = {
|
|
86
|
+
missing: "not in the H1 or the first 100 words",
|
|
87
|
+
repetitive: "over 3% of the words",
|
|
88
|
+
forced: "over 5% of the words, or in most subheadings",
|
|
89
|
+
};
|
|
90
|
+
const kwUse = obj(raw.keywordUse),
|
|
91
|
+
kwCounts =
|
|
92
|
+
kwUse && obj(kwUse.counts)
|
|
93
|
+
? KW.map(v => [v, Number.isInteger(kwUse.counts[v]) && kwUse.counts[v] >= 0 ? kwUse.counts[v] : 0])
|
|
94
|
+
: [];
|
|
95
|
+
const kwPages =
|
|
96
|
+
kwUse && Array.isArray(kwUse.pages)
|
|
97
|
+
? kwUse.pages.filter(
|
|
98
|
+
k => obj(k) && typeof k.url === "string" && typeof k.phrase === "string" && KW_WHY[k.verdict],
|
|
99
|
+
)
|
|
100
|
+
: [];
|
|
101
|
+
const kwRow = k =>
|
|
102
|
+
`“${k.phrase}”: ${k.verdict}, ${KW_WHY[k.verdict]}${Number.isFinite(k.density) ? ` (${k.density}% of the words)` : ""}`;
|
|
103
|
+
const kwLine = () =>
|
|
104
|
+
`Keyword use on ${plural(
|
|
105
|
+
kwCounts.reduce((n, [, c]) => n + c, 0),
|
|
106
|
+
"English page",
|
|
107
|
+
)}: ${kwCounts.map(([v, c]) => `${num(c)} ${v}`).join(" · ")}.`;
|
|
108
|
+
const CONTENT_INTRO =
|
|
109
|
+
"How the descriptions and the main keyword are written, for information: these notes never change the score. Each English page's main phrase is taken from its title; the 3% and 5% lines are our own, from CONTENT-03's “no density targets above about 2–3%”.";
|
|
110
|
+
const descriptions = () =>
|
|
111
|
+
(tdShare || kwCounts.length) && {
|
|
112
|
+
cls: "content",
|
|
113
|
+
title: "Descriptions and keyword use",
|
|
114
|
+
blocks: [
|
|
115
|
+
{ p: CONTENT_INTRO },
|
|
116
|
+
tdShare && { p: tdText() },
|
|
117
|
+
kwCounts.length && { p: kwLine() },
|
|
118
|
+
kwCounts.length && { rows: kwPages.map(k => [{ code: notePath(k.url) }, kwRow(k)]), cap: 10 },
|
|
119
|
+
kwPages.length > 10 && listedIn(kwPages.length, mdFile),
|
|
120
|
+
],
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// App link files missing or broken on a site that promotes an app, and PDFs that several pages or the menu link to,
|
|
124
|
+
// which Microsoft Advertising advised against for core information (8 Oct 2025). Crawled text is escaped.
|
|
125
|
+
// https://developers.google.com/search/blog/2025/05/app-deep-links
|
|
126
|
+
const appLinks = (Array.isArray(raw.appLinks) ? raw.appLinks : [])
|
|
127
|
+
.filter(a => obj(a) && ["Android", "iOS"].includes(a.platform) && isText(a.file) && isText(a.problem))
|
|
128
|
+
.slice(0, 2);
|
|
129
|
+
const pdfLinks = (l =>
|
|
130
|
+
l && Array.isArray(l.pdfs) ? l.pdfs.filter(p => obj(p) && isText(p.url) && isCount(p.pages)).slice(0, 20) : [])(
|
|
131
|
+
obj(raw.pdfLinks),
|
|
132
|
+
);
|
|
133
|
+
const APP_INTRO =
|
|
134
|
+
"The site links to its app. Phones open the site's links in the app only when a file on the site names the app. Google's post on app deep links (2 May 2025) says they don't change how Google ranks or shows pages: they take people from search results straight into the app. Information only: none of this changes the score.";
|
|
135
|
+
const appTail = a =>
|
|
136
|
+
`${a.problem}. ${a.missing === true ? "That's fine if the app doesn't open the site's links." : `${a.platform === "iOS" ? "iPhones" : "Android phones"} won't open the site's links in the app until it's fixed.`}`;
|
|
137
|
+
const PDF_INTRO =
|
|
138
|
+
"PDFs on the site that 3 or more pages link to (our own cut-off), or that the menu links to. Microsoft Advertising's guide to AI search answers (8 Oct 2025) says to avoid relying on PDFs for core information: search engines can read text PDFs, but they often lack the headings and other structure HTML gives. If any of these hold something important, such as prices, a menu, specifications or opening hours, put it on an HTML page too. Information only: none of this changes the score.";
|
|
139
|
+
const pdfTail = p => `linked from ${plural(p.pages, "page")}${p.menu === true ? ", including the menu" : ""}`;
|
|
140
|
+
const appsPdfs = () =>
|
|
141
|
+
(appLinks.length || pdfLinks.length) && {
|
|
142
|
+
cls: "hygiene",
|
|
143
|
+
title: "App links and PDFs",
|
|
144
|
+
blocks: [
|
|
145
|
+
appLinks.length && { p: APP_INTRO },
|
|
146
|
+
{ rows: appLinks.map(a => [a.platform, [{ code: a.file }, " ", appTail(a)], ": "]) },
|
|
147
|
+
pdfLinks.length && { p: PDF_INTRO },
|
|
148
|
+
{ rows: pdfLinks.map(p => [{ code: notePath(p.url) }, pdfTail(p)]) },
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// audiences (audience.md) is written into seo-audit.json and may quote page text, so every string is escaped.
|
|
153
|
+
// Malformed entries are dropped quietly, and lists are capped at 4 audiences, 5 pages each and 10 items a list.
|
|
154
|
+
const audStrs = x => (Array.isArray(x) ? x.filter(s => typeof s === "string" && s.trim()).slice(0, 10) : []);
|
|
155
|
+
const audiences = (Array.isArray(raw.audiences) ? raw.audiences : [])
|
|
156
|
+
.filter(a => obj(a) && typeof a.name === "string" && a.name.trim())
|
|
157
|
+
.map(a => ({
|
|
158
|
+
name: a.name,
|
|
159
|
+
who: [
|
|
160
|
+
typeof a.wants === "string" && a.wants.trim() && `What they come for: ${a.wants}.`,
|
|
161
|
+
typeof a.checked === "string" && /^\d{4}-\d{2}-\d{2}$/.test(a.checked) && `Checked on ${a.checked}.`,
|
|
162
|
+
]
|
|
163
|
+
.filter(Boolean)
|
|
164
|
+
.join(" "),
|
|
165
|
+
pages: (Array.isArray(a.pages) ? a.pages : [])
|
|
166
|
+
.filter(p => obj(p) && typeof p.url === "string" && p.url.trim())
|
|
167
|
+
.map(p => ({
|
|
168
|
+
path: notePath(p.url),
|
|
169
|
+
lines: [audStrs(p.has), audStrs(p.missing)]
|
|
170
|
+
.map((l, i) => l.length && `${i ? "Missing" : "On the page"}: ${l.join(" · ")}`)
|
|
171
|
+
.filter(Boolean),
|
|
172
|
+
}))
|
|
173
|
+
.filter(p => p.lines.length)
|
|
174
|
+
.slice(0, 5),
|
|
175
|
+
}))
|
|
176
|
+
.filter(a => a.pages.length)
|
|
177
|
+
.slice(0, 4);
|
|
178
|
+
const AUDIENCE_INTRO =
|
|
179
|
+
"What your key pages give each audience you named, with evidence from the page. It's a checklist, not a score: it never changes the score or the findings. A missing item becomes new text only through brief or rewrite mode, and only with your yes.";
|
|
180
|
+
// Per audience: one line on the page, a ### heading in the Markdown. A page's lines break with <br> on the page and
|
|
181
|
+
// nest under it in the Markdown.
|
|
182
|
+
const audience = () =>
|
|
183
|
+
audiences.length && {
|
|
184
|
+
cls: "audience",
|
|
185
|
+
title: "Audience check",
|
|
186
|
+
blocks: [
|
|
187
|
+
{ p: AUDIENCE_INTRO },
|
|
188
|
+
...audiences.flatMap(a => [
|
|
189
|
+
{
|
|
190
|
+
html: `<p><b>${esc(a.name)}</b>${a.who ? ` · ${esc(a.who)}` : ""}</p>`,
|
|
191
|
+
md: [`### ${noteMd(a.name)}`, "", ...(a.who ? [noteMd(a.who), ""] : [])],
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
rows: a.pages.map(p => [
|
|
195
|
+
{ code: p.path },
|
|
196
|
+
{ html: p.lines.map(esc).join("<br>"), md: p.lines.map(l => `\n - ${noteMd(l)}`).join("") },
|
|
197
|
+
"",
|
|
198
|
+
]),
|
|
199
|
+
},
|
|
200
|
+
]),
|
|
201
|
+
],
|
|
202
|
+
};
|
|
203
|
+
return { writing, productData, descriptions, appsPdfs, audience };
|
|
204
|
+
}
|