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,379 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// Search & AI panels from the tools' results. Each returns a view model, or null with nothing to show; report/panel.mjs
|
|
3
|
+
// escapes the text from logs, Search Console and the crawl.
|
|
4
|
+
import { fmtDate, num, obj, plural, isCount, isText, notePath } from "../format.mjs";
|
|
5
|
+
import { fromLine, periodOf, sameSource } from "../sources.mjs";
|
|
6
|
+
|
|
7
|
+
const arr = x => (Array.isArray(x) ? x.filter(obj) : []);
|
|
8
|
+
const fin = Number.isFinite;
|
|
9
|
+
const pct = (was, now) =>
|
|
10
|
+
was > 0 ? `${now >= was ? "+" : "−"}${Math.abs(Math.round((100 * (now - was)) / was))}%` : "";
|
|
11
|
+
const MD_MAX = 50; // Markdown rows, a local cap (the page shows 10)
|
|
12
|
+
|
|
13
|
+
// logScan is log-scan.json whole. User agents can be spoofed, so every count is "requests claiming to be". Only 404s
|
|
14
|
+
// the site doesn't link to show here, as linked ones are findings. Kinds are data/ai-bots.json's groups.
|
|
15
|
+
const KIND = { search: "Search", "ai-search": "AI search or answers", "ai-training": "AI training", other: "Other" };
|
|
16
|
+
export function logsPanel({ raw }) {
|
|
17
|
+
const l = obj(raw.logScan);
|
|
18
|
+
if (!l) return null;
|
|
19
|
+
const bots = Object.entries(obj(l.bots) || {})
|
|
20
|
+
.filter(([, b]) => obj(b) && isCount(b.requests) && b.requests > 0)
|
|
21
|
+
.sort((a, b) => b[1].requests - a[1].requests);
|
|
22
|
+
const ai = Object.entries(obj(l.aiReferrals) || {})
|
|
23
|
+
.filter(([, r]) => obj(r) && isCount(r.visits) && r.visits > 0)
|
|
24
|
+
.sort((a, b) => b[1].visits - a[1].visits);
|
|
25
|
+
const g = obj(l.googleReferrals),
|
|
26
|
+
google = g && isCount(g.visits) && g.visits > 0 ? g : null;
|
|
27
|
+
const lost = arr(l.repeated404s).filter(r => isText(r.path) && isCount(r.requests));
|
|
28
|
+
if (!bots.length && !ai.length && !google && !lost.length) return null;
|
|
29
|
+
const tops = list =>
|
|
30
|
+
arr(list)
|
|
31
|
+
.filter(p => isText(p.path) && isCount(p.visits))
|
|
32
|
+
.slice(0, 3)
|
|
33
|
+
.flatMap((p, i) => [i ? ", " : "", { code: p.path }, ` ${num(p.visits)}`]);
|
|
34
|
+
const ip = b =>
|
|
35
|
+
obj(b.ipCheck) && isCount(b.ipCheck.verified)
|
|
36
|
+
? `${num(b.ipCheck.verified)} from ${b.vendor || "the vendor"}'s addresses`
|
|
37
|
+
: "";
|
|
38
|
+
const p = obj(l.period),
|
|
39
|
+
when =
|
|
40
|
+
p && [p.from, p.to].every(d => typeof d === "string" && d)
|
|
41
|
+
? ` Logs from ${fmtDate(p.from)} to ${fmtDate(p.to)}.`
|
|
42
|
+
: "";
|
|
43
|
+
return {
|
|
44
|
+
tab: "search-ai",
|
|
45
|
+
cls: "logs",
|
|
46
|
+
title: "Server logs",
|
|
47
|
+
blocks: [
|
|
48
|
+
{
|
|
49
|
+
p: `${fromLine(raw, "logScan")}${when} User agents can be spoofed, so each count is requests claiming to be that bot. Information only: none of this changes the score.`.trim(),
|
|
50
|
+
},
|
|
51
|
+
bots.length && {
|
|
52
|
+
head: ["Bot", "Vendor", "Kind", "Requests", "Paths"],
|
|
53
|
+
align: ["---", "---", "---", "---:", "---:"],
|
|
54
|
+
cap: 10,
|
|
55
|
+
rows: bots
|
|
56
|
+
.slice(0, MD_MAX)
|
|
57
|
+
.map(([name, b]) => [
|
|
58
|
+
{ code: name },
|
|
59
|
+
String(b.vendor ?? ""),
|
|
60
|
+
KIND[b.group] || String(b.group ?? ""),
|
|
61
|
+
`${num(b.requests)}${ip(b) ? ` (${ip(b)})` : ""}`,
|
|
62
|
+
isCount(b.paths) ? num(b.paths) : "",
|
|
63
|
+
]),
|
|
64
|
+
},
|
|
65
|
+
ai.length && {
|
|
66
|
+
sub: "Visits referred by AI assistants",
|
|
67
|
+
heading: "Visits referred by AI assistants",
|
|
68
|
+
blocks: [
|
|
69
|
+
{
|
|
70
|
+
rows: ai.map(([s, r]) => [
|
|
71
|
+
{ code: s },
|
|
72
|
+
[
|
|
73
|
+
`${plural(r.visits, "visit")}`,
|
|
74
|
+
...(tops(r.topPages).length ? [" · top pages: ", ...tops(r.topPages)] : []),
|
|
75
|
+
],
|
|
76
|
+
]),
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
google && {
|
|
81
|
+
sub: "Visits referred by Google Search",
|
|
82
|
+
heading: "Visits referred by Google Search",
|
|
83
|
+
blocks: [
|
|
84
|
+
{
|
|
85
|
+
p: [
|
|
86
|
+
`${plural(google.visits, "visit")} with a Google Search referrer`,
|
|
87
|
+
...(tops(google.topPages).length ? [" · top pages: ", ...tops(google.topPages)] : []),
|
|
88
|
+
". Browsers and apps often drop the referrer, so Search Console's clicks are the real number.",
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
lost.length && {
|
|
94
|
+
sub: "URLs that keep answering 404 to search crawlers",
|
|
95
|
+
heading: "URLs that keep answering 404 to search crawlers",
|
|
96
|
+
blocks: [
|
|
97
|
+
{
|
|
98
|
+
p: "The site doesn't link to these. A 404 is right for a removed page; if one moved, 301 it to its new home.",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
rows: lost.slice(0, MD_MAX).map(r => {
|
|
102
|
+
const who = Array.isArray(r.bots) ? r.bots.filter(isText) : [];
|
|
103
|
+
return [
|
|
104
|
+
{ code: r.path },
|
|
105
|
+
`${plural(r.requests, "request")}${who.length ? ` from ${who.join(", ")}` : ""}`,
|
|
106
|
+
];
|
|
107
|
+
}),
|
|
108
|
+
cap: 10,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// The brand trend needs `previous`, Google's brand label for the period before, set only when Google labelled all of
|
|
117
|
+
// it. The current split alone is already a search line.
|
|
118
|
+
const side = x => (obj(x) && fin(x.clicks) && fin(x.impressions) ? x : null);
|
|
119
|
+
export function brandTrendPanel({ raw }) {
|
|
120
|
+
const b = obj(raw.brandSplit),
|
|
121
|
+
was = obj(b?.previous);
|
|
122
|
+
if (!side(b?.branded) || !side(b?.nonBranded) || !side(was?.branded) || !side(was?.nonBranded)) return null;
|
|
123
|
+
const period = periodOf(raw, "brandSplit");
|
|
124
|
+
const row = (label, x) => [
|
|
125
|
+
label,
|
|
126
|
+
num(x.branded.clicks),
|
|
127
|
+
num(x.branded.impressions),
|
|
128
|
+
num(x.nonBranded.clicks),
|
|
129
|
+
num(x.nonBranded.impressions),
|
|
130
|
+
];
|
|
131
|
+
const move = k =>
|
|
132
|
+
`${num(was[k].clicks)} → ${num(b[k].clicks)} clicks${pct(was[k].clicks, b[k].clicks) ? ` (${pct(was[k].clicks, b[k].clicks)})` : ""}`;
|
|
133
|
+
return {
|
|
134
|
+
tab: "search-ai",
|
|
135
|
+
cls: "brandtrend",
|
|
136
|
+
title: "Brand and other searches over time",
|
|
137
|
+
blocks: [
|
|
138
|
+
{
|
|
139
|
+
p: `${fromLine(raw, "brandSplit")} Brand searches, as Google labels them: ${move("branded")}; other searches: ${move("nonBranded")}. Growth that comes only from people who already know the brand isn't new reach. Information only.`.trim(),
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
head: ["Period", "Brand clicks", "Brand impressions", "Other clicks", "Other impressions"],
|
|
143
|
+
align: ["---", "---:", "---:", "---:", "---:"],
|
|
144
|
+
rows: [
|
|
145
|
+
row(isText(was.from) && isText(was.to) ? `${was.from} to ${was.to}` : "The period before", was),
|
|
146
|
+
row(isText(period) ? period : "This period", b),
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Pages and period come from the same source as the queries, else the pages' own source. Searches are third-party
|
|
154
|
+
// text, escaped.
|
|
155
|
+
export function topSearchesPanel({ raw }) {
|
|
156
|
+
const of = raw.queries === undefined ? "traffic" : "queries",
|
|
157
|
+
traffic = obj(sameSource(raw, of, "traffic")),
|
|
158
|
+
period = periodOf(raw, of);
|
|
159
|
+
const byClicks = (a, b) => b.clicks - a.clicks || b.impressions - a.impressions;
|
|
160
|
+
const searches = arr(raw.queries)
|
|
161
|
+
.filter(q => isText(q.query) && fin(q.clicks) && fin(q.impressions))
|
|
162
|
+
.sort(byClicks);
|
|
163
|
+
const pages = Object.entries(traffic || {})
|
|
164
|
+
.filter(([, t]) => obj(t) && fin(t.clicks) && fin(t.impressions))
|
|
165
|
+
.map(([path, t]) => ({ path, ...t }))
|
|
166
|
+
.sort(byClicks);
|
|
167
|
+
if (!searches.length && !pages.length) return null;
|
|
168
|
+
return {
|
|
169
|
+
tab: "search-ai",
|
|
170
|
+
cls: "topsearches",
|
|
171
|
+
title: "Top searches and pages",
|
|
172
|
+
blocks: [
|
|
173
|
+
{
|
|
174
|
+
p: `${fromLine(raw, of)}${isText(period) ? ` Google Search, ${period.charAt(0).toLowerCase()}${period.slice(1)}.` : ""} Google hides searches very few people make, so the searches add up to fewer clicks than the pages. Information only.`.trim(),
|
|
175
|
+
},
|
|
176
|
+
searches.length && {
|
|
177
|
+
sub: "What people search to find you",
|
|
178
|
+
heading: "What people search to find you",
|
|
179
|
+
blocks: [
|
|
180
|
+
{
|
|
181
|
+
head: ["Search", "Clicks", "Impressions", "Position"],
|
|
182
|
+
align: ["---", "---:", "---:", "---:"],
|
|
183
|
+
cap: 10,
|
|
184
|
+
rows: searches
|
|
185
|
+
.slice(0, MD_MAX)
|
|
186
|
+
.map(q => [q.query, num(q.clicks), num(q.impressions), fin(q.position) ? String(q.position) : ""]),
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
pages.length && {
|
|
191
|
+
sub: "Pages with the most clicks",
|
|
192
|
+
heading: "Pages with the most clicks",
|
|
193
|
+
blocks: [
|
|
194
|
+
{
|
|
195
|
+
head: ["Page", "Clicks", "Impressions"],
|
|
196
|
+
align: ["---", "---:", "---:"],
|
|
197
|
+
cap: 10,
|
|
198
|
+
rows: pages.slice(0, MD_MAX).map(t => [{ code: t.path }, num(t.clicks), num(t.impressions)]),
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// keywordIdeas is keyword-ideas.json whole; its link ideas and missing searches have their own panels. Phrases come
|
|
207
|
+
// from Search Console and pages from the crawl, so both are escaped.
|
|
208
|
+
const IDEAS = [
|
|
209
|
+
[
|
|
210
|
+
"almostThere",
|
|
211
|
+
"Almost there",
|
|
212
|
+
"Searches at position 8 to 20 with impressions: a small improvement can bring them onto page one.",
|
|
213
|
+
],
|
|
214
|
+
[
|
|
215
|
+
"gaps",
|
|
216
|
+
"Shown for, but no page is about it",
|
|
217
|
+
"Searches below page one where no page's title or H1 holds the search's main words. A new page or a section could answer them.",
|
|
218
|
+
],
|
|
219
|
+
["questions", "Questions people search", "Each could be an FAQ entry or a section on the page that fits best."],
|
|
220
|
+
];
|
|
221
|
+
export function keywordIdeasPanel({ raw }) {
|
|
222
|
+
const k = obj(raw.keywordIdeas),
|
|
223
|
+
kd = obj(raw.keywordData);
|
|
224
|
+
const groups = IDEAS.map(
|
|
225
|
+
([key, title, what]) =>
|
|
226
|
+
/** @type {[string, string, any[]]} */ ([title, what, arr(k?.[key]).filter(i => isText(i.phrase))]),
|
|
227
|
+
).filter(([, , list]) => list.length);
|
|
228
|
+
if (!groups.length) return null;
|
|
229
|
+
const volume = new Map(
|
|
230
|
+
arr(kd?.keywords)
|
|
231
|
+
.filter(r => isText(r.keyword) && fin(r.volume))
|
|
232
|
+
.map(r => [r.keyword.toLowerCase(), r.volume]),
|
|
233
|
+
);
|
|
234
|
+
const ev = i => {
|
|
235
|
+
const e = i.evidence,
|
|
236
|
+
v = volume.get(i.phrase.toLowerCase());
|
|
237
|
+
const parts =
|
|
238
|
+
obj(e) && fin(e.impressions)
|
|
239
|
+
? [
|
|
240
|
+
`${plural(e.impressions, "impression")}${fin(e.position) ? `, position ${e.position}` : ""}`,
|
|
241
|
+
...(isText(e.page) ? [", shows ", { code: e.page }] : []),
|
|
242
|
+
]
|
|
243
|
+
: [];
|
|
244
|
+
return fin(v)
|
|
245
|
+
? [`${num(v)} searches a month`, ...(parts.length ? [" · ", ...parts] : [])]
|
|
246
|
+
: parts.length
|
|
247
|
+
? parts
|
|
248
|
+
: "";
|
|
249
|
+
};
|
|
250
|
+
const volumes = volume.size
|
|
251
|
+
? `Searches a month are from your ${isText(kd.serviceName) ? kd.serviceName : "keyword data"} account; none are guessed.`
|
|
252
|
+
: "There are no search volumes: those need paid data, and none are guessed.";
|
|
253
|
+
return {
|
|
254
|
+
tab: "search-ai",
|
|
255
|
+
cls: "keywordideas",
|
|
256
|
+
title: "Keyword ideas",
|
|
257
|
+
blocks: [
|
|
258
|
+
{
|
|
259
|
+
p: `${fromLine(raw, "keywordIdeas")} From Search Console. You pick which ideas become targets. ${volumes} Information only.`.trim(),
|
|
260
|
+
},
|
|
261
|
+
...groups.map(([title, what, list]) => ({
|
|
262
|
+
sub: `${title} (${num(list.length)})`,
|
|
263
|
+
heading: title,
|
|
264
|
+
blocks: [{ p: what }, { rows: list.slice(0, MD_MAX).map(i => [i.phrase, ev(i), ": "]), cap: 10 }],
|
|
265
|
+
})),
|
|
266
|
+
],
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// keywordData is keyword-data.json; text from the service is escaped.
|
|
271
|
+
export function keywordDataPanel({ raw }) {
|
|
272
|
+
const k = obj(raw.keywordData);
|
|
273
|
+
const rows = arr(k?.keywords).filter(r => isText(r.keyword)),
|
|
274
|
+
rivals = arr(k?.competitors).filter(c => isText(c.domain) && arr(c.keywords).length);
|
|
275
|
+
if (!rows.length && !rivals.length) return null;
|
|
276
|
+
const n = v => (fin(v) ? num(v) : "–"),
|
|
277
|
+
name = isText(k.serviceName) ? k.serviceName : "keyword data";
|
|
278
|
+
const country =
|
|
279
|
+
isText(k.country) && /^[A-Z]{2}$/.test(k.country)
|
|
280
|
+
? new Intl.DisplayNames(["en"], { type: "region" }).of(k.country)
|
|
281
|
+
: "";
|
|
282
|
+
const where = [country, isText(k.language) ? `in ${k.language}` : ""].filter(Boolean).join(", ");
|
|
283
|
+
const missing = (Array.isArray(k.notFound) ? k.notFound : []).filter(isText);
|
|
284
|
+
const intent = r => (Array.isArray(r.intent) ? r.intent : []).filter(isText).join(", ");
|
|
285
|
+
return {
|
|
286
|
+
tab: "search-ai",
|
|
287
|
+
cls: "keyworddata",
|
|
288
|
+
title: "Keyword data",
|
|
289
|
+
blocks: [
|
|
290
|
+
{
|
|
291
|
+
p: `${fromLine(raw, "keywordData")} From your ${name} account${where ? `, for ${where}` : ""}: monthly searches, ${name}'s own difficulty score, cost per click in US dollars and search intent. Information only.`.trim(),
|
|
292
|
+
},
|
|
293
|
+
...(rows.length
|
|
294
|
+
? [
|
|
295
|
+
{
|
|
296
|
+
head: ["Keyword", "Searches a month", "Difficulty", "Cost per click", "Intent"],
|
|
297
|
+
align: ["---", "--:", "--:", "--:", "---"],
|
|
298
|
+
cap: 10,
|
|
299
|
+
rows: rows
|
|
300
|
+
.slice(0, MD_MAX)
|
|
301
|
+
.map(r => [
|
|
302
|
+
r.keyword,
|
|
303
|
+
n(r.volume),
|
|
304
|
+
n(r.difficulty),
|
|
305
|
+
fin(r.cpc) ? `$${r.cpc.toFixed(2)}` : "–",
|
|
306
|
+
intent(r),
|
|
307
|
+
]),
|
|
308
|
+
},
|
|
309
|
+
]
|
|
310
|
+
: []),
|
|
311
|
+
...(missing.length
|
|
312
|
+
? [{ p: `No data for ${plural(missing.length, "keyword")}: ${missing.slice(0, 20).join(", ")}.` }]
|
|
313
|
+
: []),
|
|
314
|
+
...rivals.map(c => {
|
|
315
|
+
const list = arr(c.keywords).filter(r => isText(r.keyword)),
|
|
316
|
+
title = `Keywords ${c.domain} ranks for and you don't`;
|
|
317
|
+
return {
|
|
318
|
+
sub: `${title} (${num(list.length)})`,
|
|
319
|
+
heading: title,
|
|
320
|
+
blocks: [
|
|
321
|
+
{
|
|
322
|
+
head: ["Keyword", "Searches a month", "Their position", "Their page"],
|
|
323
|
+
align: ["---", "--:", "--:", "---"],
|
|
324
|
+
cap: 10,
|
|
325
|
+
rows: list
|
|
326
|
+
.slice(0, MD_MAX)
|
|
327
|
+
.map(r => [r.keyword, n(r.volume), n(r.position), isText(r.url) ? { code: notePath(r.url) } : "–"]),
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
};
|
|
331
|
+
}),
|
|
332
|
+
],
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// URL Inspection verdicts as Google defines them; coverageState is Google's own text.
|
|
337
|
+
// https://developers.google.com/webmaster-tools/v1/urlInspection.index/UrlInspectionResult
|
|
338
|
+
const VERDICT = {
|
|
339
|
+
PASS: "Valid",
|
|
340
|
+
FAIL: "Error",
|
|
341
|
+
NEUTRAL: "Excluded",
|
|
342
|
+
PARTIAL: "Partial",
|
|
343
|
+
VERDICT_UNSPECIFIED: "Unknown",
|
|
344
|
+
};
|
|
345
|
+
export function indexVerdictPanel({ raw }) {
|
|
346
|
+
const pages = arr(raw.inspection).filter(i => isText(i.url));
|
|
347
|
+
if (!pages.length) return null;
|
|
348
|
+
const n = {};
|
|
349
|
+
for (const i of pages) n[VERDICT[i.verdict] || "Unknown"] = (n[VERDICT[i.verdict] || "Unknown"] || 0) + 1;
|
|
350
|
+
const count = Object.entries(n)
|
|
351
|
+
.map(([v, k]) => `${num(k)} ${v.toLowerCase()}`)
|
|
352
|
+
.join(" · ");
|
|
353
|
+
return {
|
|
354
|
+
tab: "search-ai",
|
|
355
|
+
cls: "indexverdict",
|
|
356
|
+
title: "Google's index verdict on key pages",
|
|
357
|
+
blocks: [
|
|
358
|
+
{
|
|
359
|
+
p: `${fromLine(raw, "inspection")} Search Console's URL Inspection, for ${plural(pages.length, "page")}: ${count}. Pages Google hasn't indexed are also findings. Information only.`.trim(),
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
head: ["Page", "Verdict", "Google says", "Last crawled"],
|
|
363
|
+
align: ["---", "---", "---", "---"],
|
|
364
|
+
cap: 10,
|
|
365
|
+
rows: pages.map(i => [
|
|
366
|
+
{ code: notePath(i.url) },
|
|
367
|
+
VERDICT[i.verdict] || "Unknown",
|
|
368
|
+
[
|
|
369
|
+
String(i.coverageState ?? ""),
|
|
370
|
+
isText(i.googleCanonical) && isText(i.userCanonical) && i.googleCanonical !== i.userCanonical
|
|
371
|
+
? `; Google chose ${notePath(i.googleCanonical)} as the canonical`
|
|
372
|
+
: "",
|
|
373
|
+
],
|
|
374
|
+
isText(i.lastCrawlTime) ? fmtDate(i.lastCrawlTime) : "",
|
|
375
|
+
]),
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
};
|
|
379
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// The schema inventory on the Site & content tab: pages with the same JSON-LD, Microdata and RDFa types share a row.
|
|
3
|
+
// Schema problems are ordinary findings. Types come from the site's markup, so report/panel.mjs escapes them.
|
|
4
|
+
import { num, obj, plural, isText, notePath } from "../format.mjs";
|
|
5
|
+
import { fromLine } from "../sources.mjs";
|
|
6
|
+
|
|
7
|
+
export function schemaInventoryPanel({ raw }) {
|
|
8
|
+
const list = x => (Array.isArray(x) ? x.filter(isText) : []);
|
|
9
|
+
const pages = (Array.isArray(raw.pages) ? raw.pages : []).filter(p => obj(p) && isText(p.url));
|
|
10
|
+
const typed = pages
|
|
11
|
+
.map(p => ({ path: notePath(p.url), types: [...new Set([...list(p.schema), ...list(p.schemaOther)])].sort() }))
|
|
12
|
+
.filter(p => p.types.length);
|
|
13
|
+
if (!typed.length) return null;
|
|
14
|
+
const byType = new Map(),
|
|
15
|
+
bySet = new Map();
|
|
16
|
+
for (const p of typed) {
|
|
17
|
+
for (const t of p.types) byType.set(t, (byType.get(t) || 0) + 1);
|
|
18
|
+
const k = p.types.join(", ");
|
|
19
|
+
(bySet.get(k) || bySet.set(k, []).get(k)).push(p.path);
|
|
20
|
+
}
|
|
21
|
+
const types = [...byType].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])),
|
|
22
|
+
sets = [...bySet].sort((a, b) => b[1].length - a[1].length || a[0].localeCompare(b[0]));
|
|
23
|
+
return {
|
|
24
|
+
tab: "site-content",
|
|
25
|
+
cls: "schemainventory",
|
|
26
|
+
title: "Structured data on each page",
|
|
27
|
+
blocks: [
|
|
28
|
+
{
|
|
29
|
+
p: `${fromLine(raw, "pages")} ${plural(typed.length, "page")} of ${num(pages.length)} crawled ${typed.length === 1 ? "has" : "have"} structured data. By type: ${types
|
|
30
|
+
.slice(0, 20)
|
|
31
|
+
.map(([t, n]) => `${t} ${num(n)}`)
|
|
32
|
+
.join(
|
|
33
|
+
" · ",
|
|
34
|
+
)}${types.length > 20 ? ` and ${num(types.length - 20)} more` : ""}. Information only; schema problems are findings.`.trim(),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
head: ["Types", "Pages", "For example"],
|
|
38
|
+
align: ["---", "---:", "---"],
|
|
39
|
+
cap: 10,
|
|
40
|
+
rows: sets.slice(0, 50).map(([k, l]) => [k, num(l.length), { code: l[0] }]),
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
}
|