@cobola/dsh-geo 0.9.0 → 0.10.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/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/bin/dsh-geo.js +4 -0
- package/client.js +13 -0
- package/docs/CI.md +1 -1
- package/docs/RULES.md +67 -59
- package/docs/index.json +1 -1
- package/examples/geo-audit.yml +1 -1
- package/examples/geo-baseline.yml +1 -1
- package/index.js +10 -1
- package/lib/html.js +11 -0
- package/lib/report.js +18 -0
- package/lib/rules.js +225 -1
- package/lib/score.js +27 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0 - 2026-11-29
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Add the SEO / AEO / GEO pillar view. Every rule now declares one pillar, and
|
|
8
|
+
the pillar scores appear in the CLI, audit report, tool result and in-chat card.
|
|
9
|
+
Pillars are a second view over the same findings: they never change the Core
|
|
10
|
+
total.
|
|
11
|
+
- Add eight checks: viewport declaration, image dimensions, lazy loading, URL
|
|
12
|
+
structure, hreflang (SEO); answer-first opening, question-heading density and
|
|
13
|
+
extractable term blocks (AEO).
|
|
14
|
+
- Rubric is now 53 checks: SEO 26, AEO 16, GEO 11.
|
|
15
|
+
|
|
16
|
+
### Notes
|
|
17
|
+
|
|
18
|
+
- `seo.hreflang` reports `skip` on single-language sites instead of penalising
|
|
19
|
+
them.
|
|
20
|
+
|
|
21
|
+
|
|
3
22
|
## 0.9.0 - 2026-11-29
|
|
4
23
|
|
|
5
24
|
### Features
|
package/README.md
CHANGED
package/bin/dsh-geo.js
CHANGED
|
@@ -207,6 +207,10 @@ function renderScan(report, scan, extras = {}) {
|
|
|
207
207
|
for (const dimension of report.dimensions) {
|
|
208
208
|
lines.push(`${dimension.title.padEnd(6, ' ')} ${String(dimension.score).padStart(5, ' ')} ${bar(dimension.score)} 权重 ${dimension.weight}`);
|
|
209
209
|
}
|
|
210
|
+
if (Array.isArray(report.pillars) && report.pillars.length > 0) {
|
|
211
|
+
lines.push('');
|
|
212
|
+
lines.push(report.pillars.map((pillar) => `${pillar.title} ${pillar.score}`).join(' · ') + ' (支柱视图)');
|
|
213
|
+
}
|
|
210
214
|
for (const platform of report.platforms ?? []) {
|
|
211
215
|
lines.push(`${platform.title.padEnd(14, ' ')} ${String(platform.total).padStart(5, ' ')} ${bar(platform.total)} 平台参考分(不计入总分)`);
|
|
212
216
|
}
|
package/client.js
CHANGED
|
@@ -59,6 +59,7 @@ window.__ModuleLoader__.load({
|
|
|
59
59
|
cardFailed: '体检没有完成',
|
|
60
60
|
cardDelta: '较上次',
|
|
61
61
|
cardPlatforms: '平台参考分(不计入总分)',
|
|
62
|
+
cardPillars: '支柱(SEO / AEO / GEO)',
|
|
62
63
|
cardActions: '优先修复',
|
|
63
64
|
},
|
|
64
65
|
en: {
|
|
@@ -103,6 +104,7 @@ window.__ModuleLoader__.load({
|
|
|
103
104
|
cardFailed: 'The audit did not complete',
|
|
104
105
|
cardDelta: 'vs previous',
|
|
105
106
|
cardPlatforms: 'Platform scores (not in Core total)',
|
|
107
|
+
cardPillars: 'Pillars (SEO / AEO / GEO)',
|
|
106
108
|
cardActions: 'Top fixes',
|
|
107
109
|
},
|
|
108
110
|
};
|
|
@@ -445,6 +447,17 @@ window.__ModuleLoader__.load({
|
|
|
445
447
|
}, `${t('cardDelta')} ${delta.before} → ${delta.after}(${delta.totalDelta >= 0 ? '+' : ''}${delta.totalDelta})`));
|
|
446
448
|
}
|
|
447
449
|
|
|
450
|
+
const pillarRows = (meta.pillars ?? []).map((pillar) => h('div', { key: pillar.title, style: styles.cardRow },
|
|
451
|
+
h('span', { style: styles.label }, pillar.title),
|
|
452
|
+
h('div', { style: styles.barTrack },
|
|
453
|
+
h('div', { style: { ...styles.barFill, width: `${Math.max(0, Math.min(100, pillar.score))}%` } })),
|
|
454
|
+
h('span', { style: { ...styles.hint, textAlign: 'right' } }, `${pillar.score}`)));
|
|
455
|
+
|
|
456
|
+
if (pillarRows.length > 0) {
|
|
457
|
+
children.push(h('div', { key: 'pillars', style: { marginTop: 6 } },
|
|
458
|
+
h('div', { style: styles.sectionLabel }, t('cardPillars')),
|
|
459
|
+
pillarRows));
|
|
460
|
+
}
|
|
448
461
|
if (dimensionRows.length > 0) children.push(h('div', { key: 'dimensions' }, dimensionRows));
|
|
449
462
|
if (platformRows.length > 0) {
|
|
450
463
|
children.push(h('div', { key: 'platforms', style: { marginTop: 6 } },
|
package/docs/CI.md
CHANGED
package/docs/RULES.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GEO 评分规则(geo-rubric@
|
|
1
|
+
# GEO 评分规则(geo-rubric@2)
|
|
2
2
|
|
|
3
3
|
本文件由 `scripts/gen-docs.mjs` 从 `lib/rules.js` 生成,请勿手工编辑。改规则后运行 `npm run docs`。
|
|
4
4
|
|
|
@@ -14,77 +14,85 @@
|
|
|
14
14
|
|
|
15
15
|
## 2. 规则表
|
|
16
16
|
|
|
17
|
-
共
|
|
17
|
+
共 53 条规则,分归三个支柱:SEO 26 条、AEO 16 条、GEO 11 条。支柱是同一批规则的第二个视图,不改变 Core 总分。每条规则的通过条件、证据格式与失败阈值都在 `lib/rules.js` 的 `evaluate()` 中,运行时会把证据写进报告(`findings[].evidence`),因此报告本身就能说明为什么得分。
|
|
18
18
|
|
|
19
19
|
### 可发现性(25 分)
|
|
20
20
|
|
|
21
|
-
| 规则 ID | 权重 | 检查项 | 修复建议 |
|
|
22
|
-
|
|
23
|
-
| `disc.robots-present` | 3 | robots.txt 可访问 | 在站点根目录发布 robots.txt,声明 Sitemap 与 AI 爬虫策略;返回 200 且为纯文本。 |
|
|
24
|
-
| `disc.robots-not-blocking-site` | 4 | robots.txt 未封禁站点 | 删掉对 Disallow: / 的全局封禁;只对确实需要保密的路径单独设置规则。 |
|
|
25
|
-
| `disc.ai-crawler-policy` | 3 | AI 爬虫策略明确 | 若希望被 AI 检索,在 robots.txt 显式 Allow GPTBot、ClaudeBot、PerplexityBot、Google-Extended 等;若刻意封闭,保留 Disallow 但需接受 AI 搜索不可见。 |
|
|
26
|
-
| `disc.googlebot-accessible` | 3 | Googlebot 可抓取 | 在 robots.txt 中允许 Googlebot 与 Googlebot-Image 抓取公开页面;这是 Google Search(包括生成式 AI 功能)的前提。 |
|
|
27
|
-
| `disc.sitemap-present` | 3 | XML sitemap 可用 | 发布 /sitemap.xml(或 sitemap index),每个 <url> 使用最终的可索引 URL,并在 robots.txt 里声明。 |
|
|
28
|
-
| `disc.sitemap-declared` | 2 | sitemap 已声明 | 在 robots.txt 增加 Sitemap: <绝对 URL>,或在首页 <link rel="sitemap"> / Link 响应头中声明。 |
|
|
29
|
-
| `disc.sitemap-covers-pages` | 2 | sitemap 覆盖已抓取页面 | 把被内链或导航暴露的可索引页面全部写进 sitemap,移除已 404/重定向的旧 URL。 |
|
|
30
|
-
| `disc.indexable` | 3 | 入口页可索引 | 入口页返回 200;移除 meta robots 与 X-Robots-Tag 中的 noindex/nofollow。 |
|
|
31
|
-
| `disc.canonical` | 2 | canonical 自指且为绝对地址 | 每个页面输出 <link rel="canonical" href="https://正式域名/该页路径">,与当前 URL 完全一致(含尾斜杠策略)。 |
|
|
32
|
-
| `disc.internal-links` | 3 | 入口页内链充分 | 在入口页用真实 <a href> 链接导航到核心页面(≥5 个),避免只在 JavaScript 里跳转。 |
|
|
21
|
+
| 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
|
|
22
|
+
|---|---|---|---|---|
|
|
23
|
+
| `disc.robots-present` | SEO | 3 | robots.txt 可访问 | 在站点根目录发布 robots.txt,声明 Sitemap 与 AI 爬虫策略;返回 200 且为纯文本。 |
|
|
24
|
+
| `disc.robots-not-blocking-site` | SEO | 4 | robots.txt 未封禁站点 | 删掉对 Disallow: / 的全局封禁;只对确实需要保密的路径单独设置规则。 |
|
|
25
|
+
| `disc.ai-crawler-policy` | GEO | 3 | AI 爬虫策略明确 | 若希望被 AI 检索,在 robots.txt 显式 Allow GPTBot、ClaudeBot、PerplexityBot、Google-Extended 等;若刻意封闭,保留 Disallow 但需接受 AI 搜索不可见。 |
|
|
26
|
+
| `disc.googlebot-accessible` | SEO | 3 | Googlebot 可抓取 | 在 robots.txt 中允许 Googlebot 与 Googlebot-Image 抓取公开页面;这是 Google Search(包括生成式 AI 功能)的前提。 |
|
|
27
|
+
| `disc.sitemap-present` | SEO | 3 | XML sitemap 可用 | 发布 /sitemap.xml(或 sitemap index),每个 <url> 使用最终的可索引 URL,并在 robots.txt 里声明。 |
|
|
28
|
+
| `disc.sitemap-declared` | SEO | 2 | sitemap 已声明 | 在 robots.txt 增加 Sitemap: <绝对 URL>,或在首页 <link rel="sitemap"> / Link 响应头中声明。 |
|
|
29
|
+
| `disc.sitemap-covers-pages` | SEO | 2 | sitemap 覆盖已抓取页面 | 把被内链或导航暴露的可索引页面全部写进 sitemap,移除已 404/重定向的旧 URL。 |
|
|
30
|
+
| `disc.indexable` | SEO | 3 | 入口页可索引 | 入口页返回 200;移除 meta robots 与 X-Robots-Tag 中的 noindex/nofollow。 |
|
|
31
|
+
| `disc.canonical` | SEO | 2 | canonical 自指且为绝对地址 | 每个页面输出 <link rel="canonical" href="https://正式域名/该页路径">,与当前 URL 完全一致(含尾斜杠策略)。 |
|
|
32
|
+
| `disc.internal-links` | SEO | 3 | 入口页内链充分 | 在入口页用真实 <a href> 链接导航到核心页面(≥5 个),避免只在 JavaScript 里跳转。 |
|
|
33
|
+
| `seo.url-structure` | SEO | 2 | URL 结构可读 | 用短、含语义词的路径;避免大写、下划线、过长 query 串与深层嵌套(超过 4 层)。 |
|
|
34
|
+
| `seo.hreflang` | SEO | 1 | 多语言 hreflang | 若站点有多个语言版本,用 <link rel="alternate" hreflang="..."> 标注互指;单语言站点可忽略。 |
|
|
33
35
|
|
|
34
36
|
### 可解析性(20 分)
|
|
35
37
|
|
|
36
|
-
| 规则 ID | 权重 | 检查项 | 修复建议 |
|
|
37
|
-
|
|
38
|
-
| `parse.title` | 3 | <title> 长度合适 | 为每个页面写唯一的 <title>,10–65 个字符,包含主题词与品牌名。 |
|
|
39
|
-
| `parse.meta-description` | 2 | meta description 存在且合适 | 为每个页面输出 50–170 字的 <meta name="description">,概括该页回答的问题。 |
|
|
40
|
-
| `parse.lang` | 1 | <html lang> 已声明 | 在 <html> 上声明 lang(如 lang="zh-CN"),便于检索与语言匹配。 |
|
|
41
|
-
| `parse.h1` | 2 | 唯一且非空的主标题 | 每页保留一个 <h1> 作为主标题,用 <h2>/<h3> 组织小节。 |
|
|
42
|
-
| `parse.heading-order` | 2 | 标题层级连续 | 按 h1 → h2 → h3 顺序组织标题,不要从 h1 直接跳到 h4;每个小节都要有 h2。 |
|
|
43
|
-
| `parse.semantics` | 2 | 语义化正文容器 | 用 <main> 包裹正文、<article> 包裹独立内容,替代无语义的 <div> 堆叠。 |
|
|
44
|
-
| `parse.raw-content` | 3 | 无 JS 也能读到正文 | 服务端渲染或预渲染正文,保证不执行 JavaScript 的检索/引用管线也能读到 ≥600 字;Googlebot 能渲染 JS,但许多 AI 抓取器不能。 |
|
|
45
|
-
| `parse.pages-with-content` | 2 | 被抓取页面普遍含正文 | 确保列表页、详情页都在原始 HTML 中输出正文,而不是只输出加载骨架。 |
|
|
46
|
-
| `parse.duplicate-metadata` | 2 | 页面标题/描述不重复 | 为每个页面写唯一的 <title> 与 meta description;重复元数据会让检索系统难以区分页面,也浪费抓取预算。 |
|
|
47
|
-
| `parse.image-alt` | 2 | 图片 alt 覆盖 | 为所有内容图片补写描述性 alt;纯装饰图片使用 alt="" 并标记 role="presentation"。 |
|
|
48
|
-
| `parse.jsonld-syntax` | 2 | JSON-LD 语法有效 | 用 schema.org 词汇输出 application/ld+json,并在发布前用校验器检查括号与逗号。 |
|
|
49
|
-
| `parse.link-text` | 1 | 内链锚文本有描述性 | 把“点击这里/了解更多”改成能说明目标内容的锚文本,例如“GEO 评分方法”。 |
|
|
38
|
+
| 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
|
|
39
|
+
|---|---|---|---|---|
|
|
40
|
+
| `parse.title` | SEO | 3 | <title> 长度合适 | 为每个页面写唯一的 <title>,10–65 个字符,包含主题词与品牌名。 |
|
|
41
|
+
| `parse.meta-description` | SEO | 2 | meta description 存在且合适 | 为每个页面输出 50–170 字的 <meta name="description">,概括该页回答的问题。 |
|
|
42
|
+
| `parse.lang` | SEO | 1 | <html lang> 已声明 | 在 <html> 上声明 lang(如 lang="zh-CN"),便于检索与语言匹配。 |
|
|
43
|
+
| `parse.h1` | SEO | 2 | 唯一且非空的主标题 | 每页保留一个 <h1> 作为主标题,用 <h2>/<h3> 组织小节。 |
|
|
44
|
+
| `parse.heading-order` | SEO | 2 | 标题层级连续 | 按 h1 → h2 → h3 顺序组织标题,不要从 h1 直接跳到 h4;每个小节都要有 h2。 |
|
|
45
|
+
| `parse.semantics` | AEO | 2 | 语义化正文容器 | 用 <main> 包裹正文、<article> 包裹独立内容,替代无语义的 <div> 堆叠。 |
|
|
46
|
+
| `parse.raw-content` | AEO | 3 | 无 JS 也能读到正文 | 服务端渲染或预渲染正文,保证不执行 JavaScript 的检索/引用管线也能读到 ≥600 字;Googlebot 能渲染 JS,但许多 AI 抓取器不能。 |
|
|
47
|
+
| `parse.pages-with-content` | AEO | 2 | 被抓取页面普遍含正文 | 确保列表页、详情页都在原始 HTML 中输出正文,而不是只输出加载骨架。 |
|
|
48
|
+
| `parse.duplicate-metadata` | SEO | 2 | 页面标题/描述不重复 | 为每个页面写唯一的 <title> 与 meta description;重复元数据会让检索系统难以区分页面,也浪费抓取预算。 |
|
|
49
|
+
| `parse.image-alt` | SEO | 2 | 图片 alt 覆盖 | 为所有内容图片补写描述性 alt;纯装饰图片使用 alt="" 并标记 role="presentation"。 |
|
|
50
|
+
| `parse.jsonld-syntax` | AEO | 2 | JSON-LD 语法有效 | 用 schema.org 词汇输出 application/ld+json,并在发布前用校验器检查括号与逗号。 |
|
|
51
|
+
| `parse.link-text` | SEO | 1 | 内链锚文本有描述性 | 把“点击这里/了解更多”改成能说明目标内容的锚文本,例如“GEO 评分方法”。 |
|
|
52
|
+
| `seo.viewport` | SEO | 2 | 移动端视口声明 | 在 <head> 输出 <meta name="viewport" content="width=device-width, initial-scale=1">;缺少它会让移动端按桌面宽度渲染。 |
|
|
53
|
+
| `seo.image-dimensions` | SEO | 2 | 图片声明宽高 | 为 <img> 写上 width/height 或使用 aspect-ratio,避免加载时布局跳动(CLS)。 |
|
|
54
|
+
| `seo.image-lazy` | SEO | 1 | 首屏外图片懒加载 | 给首屏以下的图片加 loading="lazy",首屏图不要加,避免延迟最大内容渲染。 |
|
|
50
55
|
|
|
51
56
|
### 可引用性(25 分)
|
|
52
57
|
|
|
53
|
-
| 规则 ID | 权重 | 检查项 | 修复建议 |
|
|
54
|
-
|
|
55
|
-
| `cite.qa-structure` | 3 | 问答结构 | 把用户真实提问写成 h2/h3,并用 FAQPage/HowTo 结构化数据标注问答对。 |
|
|
56
|
-
| `cite.summary` | 2 | 摘要 / TL;DR 区块 | 在正文开头加一段 2–4 句的摘要(class="summary" 或 TL;DR),让引用者能直接取用。 |
|
|
57
|
-
| `cite.numeric-evidence` | 3 | 可验证的数字证据 | 补充带单位的具体数字(百分比、耗时、样本量、版本号、日期),避免只有形容词。 |
|
|
58
|
-
| `cite.authority-sources` | 2 | 引用权威来源 | 在关键论断处链接一手来源(标准文档、官方文档、论文、政府/教育站点),并保持链接可访问。 |
|
|
59
|
-
| `cite.freshness` | 3 | 内容时效可判定 | 输出 datePublished/dateModified(JSON-LD 或 <time datetime>),并在正文中显示“最后更新日期”。 |
|
|
60
|
-
| `cite.author` | 2 | 作者署名可识别 | 在页面与 Article schema 中给出作者姓名、简介与主页;匿名内容很难被引用。 |
|
|
61
|
-
| `cite.anchors` | 2 | 章节可锚点引用 | 给每个 h2/h3 加语义化 id(如 id="geo-score"),方便引用到具体小节。 |
|
|
62
|
-
| `cite.structure` | 3 | 结构化排版与短段落 | 用表格、有序列表承载对比与步骤,段落控制在 120 词以内,便于模型截取。 |
|
|
63
|
-
| `cite.snippet-ready` | 3 | 小节答案可直接摘录 | 每个 h2 下紧跟 30–140 词的直接回答,再展开细节;避免先铺垫后给结论。 |
|
|
58
|
+
| 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
|
|
59
|
+
|---|---|---|---|---|
|
|
60
|
+
| `cite.qa-structure` | AEO | 3 | 问答结构 | 把用户真实提问写成 h2/h3,并用 FAQPage/HowTo 结构化数据标注问答对。 |
|
|
61
|
+
| `cite.summary` | AEO | 2 | 摘要 / TL;DR 区块 | 在正文开头加一段 2–4 句的摘要(class="summary" 或 TL;DR),让引用者能直接取用。 |
|
|
62
|
+
| `cite.numeric-evidence` | GEO | 3 | 可验证的数字证据 | 补充带单位的具体数字(百分比、耗时、样本量、版本号、日期),避免只有形容词。 |
|
|
63
|
+
| `cite.authority-sources` | GEO | 2 | 引用权威来源 | 在关键论断处链接一手来源(标准文档、官方文档、论文、政府/教育站点),并保持链接可访问。 |
|
|
64
|
+
| `cite.freshness` | GEO | 3 | 内容时效可判定 | 输出 datePublished/dateModified(JSON-LD 或 <time datetime>),并在正文中显示“最后更新日期”。 |
|
|
65
|
+
| `cite.author` | GEO | 2 | 作者署名可识别 | 在页面与 Article schema 中给出作者姓名、简介与主页;匿名内容很难被引用。 |
|
|
66
|
+
| `cite.anchors` | AEO | 2 | 章节可锚点引用 | 给每个 h2/h3 加语义化 id(如 id="geo-score"),方便引用到具体小节。 |
|
|
67
|
+
| `cite.structure` | AEO | 3 | 结构化排版与短段落 | 用表格、有序列表承载对比与步骤,段落控制在 120 词以内,便于模型截取。 |
|
|
68
|
+
| `cite.snippet-ready` | AEO | 3 | 小节答案可直接摘录 | 每个 h2 下紧跟 30–140 词的直接回答,再展开细节;避免先铺垫后给结论。 |
|
|
69
|
+
| `aeo.answer-first` | AEO | 3 | 正文开头给出直接答案 | 在第一个 h1 之后紧跟一段 2–4 句的直接回答,再展开解释;语音助手与摘要更依赖开头的自足段落。 |
|
|
70
|
+
| `aeo.question-density` | AEO | 2 | 问句式标题覆盖 | 用用户真实的提问作为 h2/h3(“怎么…”“为什么…”“是否…”),一段回答一个问题。 |
|
|
71
|
+
| `aeo.definition-list` | AEO | 1 | 术语与要点可抽取 | 用 <dl>/<table>/<ul> 承载定义、对比与步骤;纯段落堆叠不易被答案引擎抽成条目。 |
|
|
64
72
|
|
|
65
73
|
### 实体与信任(15 分)
|
|
66
74
|
|
|
67
|
-
| 规则 ID | 权重 | 检查项 | 修复建议 |
|
|
68
|
-
|
|
69
|
-
| `trust.https` | 3 | 全站 HTTPS | 启用 HTTPS,把 HTTP 301 到 HTTPS,并提交 HSTS。 |
|
|
70
|
-
| `trust.org-schema` | 3 | 组织实体 schema | 用 Organization/LocalBusiness JSON-LD 声明 name、url、logo、sameAs,帮助实体消歧与富结果;Google 表示生成式 AI 不要求特殊 schema。 |
|
|
71
|
-
| `trust.contact` | 2 | 联系方式可找到 | 提供 /contact 页面、mailto: 或 schema contactPoint,并保持信息与实体注册一致。 |
|
|
72
|
-
| `trust.about` | 2 | About 页面可核实身份 | 提供 /about 页面,写明团队、公司主体、所在地与联系方式。 |
|
|
73
|
-
| `trust.security-headers` | 2 | 基础安全响应头 | 至少配置 HSTS(HTTPS)、Content-Security-Policy、X-Content-Type-Options: nosniff、Referrer-Policy。 |
|
|
74
|
-
| `trust.privacy` | 1 | 隐私政策可达 | 添加隐私政策页面并从页脚链接,说明数据用途与联系方式。 |
|
|
75
|
-
| `trust.sameas` | 2 | 外部身份背书 | 在 Organization sameAs 或 <link rel="me"> 中列出官方 GitHub、LinkedIn、X、维基数据等主页。 |
|
|
75
|
+
| 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
|
|
76
|
+
|---|---|---|---|---|
|
|
77
|
+
| `trust.https` | SEO | 3 | 全站 HTTPS | 启用 HTTPS,把 HTTP 301 到 HTTPS,并提交 HSTS。 |
|
|
78
|
+
| `trust.org-schema` | AEO | 3 | 组织实体 schema | 用 Organization/LocalBusiness JSON-LD 声明 name、url、logo、sameAs,帮助实体消歧与富结果;Google 表示生成式 AI 不要求特殊 schema。 |
|
|
79
|
+
| `trust.contact` | AEO | 2 | 联系方式可找到 | 提供 /contact 页面、mailto: 或 schema contactPoint,并保持信息与实体注册一致。 |
|
|
80
|
+
| `trust.about` | AEO | 2 | About 页面可核实身份 | 提供 /about 页面,写明团队、公司主体、所在地与联系方式。 |
|
|
81
|
+
| `trust.security-headers` | SEO | 2 | 基础安全响应头 | 至少配置 HSTS(HTTPS)、Content-Security-Policy、X-Content-Type-Options: nosniff、Referrer-Policy。 |
|
|
82
|
+
| `trust.privacy` | AEO | 1 | 隐私政策可达 | 添加隐私政策页面并从页脚链接,说明数据用途与联系方式。 |
|
|
83
|
+
| `trust.sameas` | GEO | 2 | 外部身份背书 | 在 Organization sameAs 或 <link rel="me"> 中列出官方 GitHub、LinkedIn、X、维基数据等主页。 |
|
|
76
84
|
|
|
77
85
|
### 机器说明书(15 分)
|
|
78
86
|
|
|
79
|
-
| 规则 ID | 权重 | 检查项 | 修复建议 |
|
|
80
|
-
|
|
81
|
-
| `manifest.llms-txt` | 2 | llms.txt(可选,非 Google 必需) | 可选:若需要服务非 Google 的 agent/工具,可发布 llms.txt(# 标题 + ## 分节 + Markdown 链接)。Google Search 明确不使用 llms.txt,不要把它当作 Google 排名手段。 |
|
|
82
|
-
| `manifest.llms-structure` | 1 | llms.txt 结构完整(可选) | 若提供 llms.txt,至少包含 2 个 ## 分节和 3 个指向正文的 Markdown 链接。注意:Google Search 不使用该文件。 |
|
|
83
|
-
| `manifest.structured-breadth` | 2 | schema.org 类型覆盖面(富结果) | 按页面类型输出 schema(Organization/WebSite、Article、FAQPage、BreadcrumbList),用于富结果与实体消歧。Google 明确表示生成式 AI 不需要特殊 schema。 |
|
|
84
|
-
| `manifest.og-cards` | 1 | OpenGraph / 分享卡片 | 为每个页面输出 og:title、og:description、og:image(1200×630)与 og:url。 |
|
|
85
|
-
| `manifest.feed` | 1 | 内容 feed(可选) | 发布 RSS/Atom feed,并用 <link rel="alternate" type="application/rss+xml"> 暴露;它服务于订阅与分发,不是 Google AI 的要求。 |
|
|
86
|
-
| `manifest.link-hints` | 1 | HTTP Link / Markdown 入口提示(可选) | 可选:在响应头加 Link: </llms.txt>; rel="llms",或提供 text/markdown alternate。Google Search 不使用这些提示。 |
|
|
87
|
-
| `manifest.entity-id` | 1 | 实体 @id 稳定 | 给 Organization/WebSite 分配稳定的 @id(如 https://example.com/#organization),所有页面复用同一 @id。 |
|
|
87
|
+
| 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
|
|
88
|
+
|---|---|---|---|---|
|
|
89
|
+
| `manifest.llms-txt` | GEO | 2 | llms.txt(可选,非 Google 必需) | 可选:若需要服务非 Google 的 agent/工具,可发布 llms.txt(# 标题 + ## 分节 + Markdown 链接)。Google Search 明确不使用 llms.txt,不要把它当作 Google 排名手段。 |
|
|
90
|
+
| `manifest.llms-structure` | GEO | 1 | llms.txt 结构完整(可选) | 若提供 llms.txt,至少包含 2 个 ## 分节和 3 个指向正文的 Markdown 链接。注意:Google Search 不使用该文件。 |
|
|
91
|
+
| `manifest.structured-breadth` | GEO | 2 | schema.org 类型覆盖面(富结果) | 按页面类型输出 schema(Organization/WebSite、Article、FAQPage、BreadcrumbList),用于富结果与实体消歧。Google 明确表示生成式 AI 不需要特殊 schema。 |
|
|
92
|
+
| `manifest.og-cards` | SEO | 1 | OpenGraph / 分享卡片 | 为每个页面输出 og:title、og:description、og:image(1200×630)与 og:url。 |
|
|
93
|
+
| `manifest.feed` | SEO | 1 | 内容 feed(可选) | 发布 RSS/Atom feed,并用 <link rel="alternate" type="application/rss+xml"> 暴露;它服务于订阅与分发,不是 Google AI 的要求。 |
|
|
94
|
+
| `manifest.link-hints` | GEO | 1 | HTTP Link / Markdown 入口提示(可选) | 可选:在响应头加 Link: </llms.txt>; rel="llms",或提供 text/markdown alternate。Google Search 不使用这些提示。 |
|
|
95
|
+
| `manifest.entity-id` | GEO | 1 | 实体 @id 稳定 | 给 Organization/WebSite 分配稳定的 @id(如 https://example.com/#organization),所有页面复用同一 @id。 |
|
|
88
96
|
|
|
89
97
|
## 3. fixture 与基线分数
|
|
90
98
|
|
|
@@ -93,8 +101,8 @@
|
|
|
93
101
|
| fixture | 总分 | 等级 | 页数 | 说明 |
|
|
94
102
|
|---|---|---|---|---|
|
|
95
103
|
| `good-static` | 100.0 | A+ | 5 | 五维全部通过,用来证明满分可达 |
|
|
96
|
-
| `bad-spa` |
|
|
97
|
-
| `bad-robots` |
|
|
104
|
+
| `bad-spa` | 32.4 | F | 1 | 正文只在 JavaScript 里,抓取器看到空壳 |
|
|
105
|
+
| `bad-robots` | 76.0 | B | 5 | 内容可读;第三方 AI 爬虫封禁提示 warn,但 Googlebot 可抓取 |
|
|
98
106
|
|
|
99
107
|
任何规则或 fixture 的改动都会让这些数字变化,测试会立即失败。要更新基线,必须先确认改动是**有意的**,再同时修改 fixture 与测试中的期望值。
|
|
100
108
|
|
package/docs/index.json
CHANGED
package/examples/geo-audit.yml
CHANGED
package/index.js
CHANGED
|
@@ -167,7 +167,7 @@ const scanOutputSchema = {
|
|
|
167
167
|
additionalProperties: false,
|
|
168
168
|
required: [
|
|
169
169
|
'url', 'scannedAt', 'pages', 'total', 'grade', 'gradeLabel', 'counts',
|
|
170
|
-
'dimensions', 'topActions', 'platforms', 'blockedByRobots', 'paths',
|
|
170
|
+
'dimensions', 'topActions', 'pillars', 'platforms', 'blockedByRobots', 'paths',
|
|
171
171
|
],
|
|
172
172
|
properties: {
|
|
173
173
|
url: { type: 'string' },
|
|
@@ -179,6 +179,7 @@ const scanOutputSchema = {
|
|
|
179
179
|
counts: countsSchema,
|
|
180
180
|
dimensions: { type: 'array', items: { type: 'object', additionalProperties: true } },
|
|
181
181
|
topActions: { type: 'array', items: { type: 'object', additionalProperties: true } },
|
|
182
|
+
pillars: { type: 'array', items: { type: 'object', additionalProperties: true } },
|
|
182
183
|
platforms: { type: 'array', items: { type: 'object', additionalProperties: true } },
|
|
183
184
|
blockedByRobots: { type: 'boolean' },
|
|
184
185
|
comparison: { type: 'object', additionalProperties: true },
|
|
@@ -210,6 +211,9 @@ function scanRender(args, value) {
|
|
|
210
211
|
for (const dimension of value.dimensions) {
|
|
211
212
|
lines.push(`- ${dimension.title}: ${dimension.score} (weight ${dimension.weight})`);
|
|
212
213
|
}
|
|
214
|
+
if (Array.isArray(value.pillars) && value.pillars.length > 0) {
|
|
215
|
+
lines.push(`- pillars: ${value.pillars.map((pillar) => `${pillar.title} ${pillar.score}`).join(' · ')}`);
|
|
216
|
+
}
|
|
213
217
|
for (const platform of value.platforms ?? []) {
|
|
214
218
|
lines.push(`- ${platform.title} (platform, not in Core score): ${platform.total}`);
|
|
215
219
|
}
|
|
@@ -274,6 +278,10 @@ export function scanPresentation(value) {
|
|
|
274
278
|
score: dimension.score,
|
|
275
279
|
weight: dimension.weight,
|
|
276
280
|
})),
|
|
281
|
+
pillars: (value.pillars ?? []).map((pillar) => ({
|
|
282
|
+
title: pillar.title,
|
|
283
|
+
score: pillar.score,
|
|
284
|
+
})),
|
|
277
285
|
platforms: (value.platforms ?? []).map((platform) => ({
|
|
278
286
|
title: platform.title,
|
|
279
287
|
total: platform.total,
|
|
@@ -373,6 +381,7 @@ export function apply(ctx, config) {
|
|
|
373
381
|
counts: summary.counts,
|
|
374
382
|
dimensions: summary.dimensions,
|
|
375
383
|
topActions: summary.topActions,
|
|
384
|
+
pillars: summary.pillars,
|
|
376
385
|
platforms: summary.platforms,
|
|
377
386
|
blockedByRobots: Boolean(scan.blockedByRobots),
|
|
378
387
|
paths,
|
package/lib/html.js
CHANGED
|
@@ -421,11 +421,16 @@ export function analyzeHtml(html, pageUrl) {
|
|
|
421
421
|
const src = attribute(node, 'src');
|
|
422
422
|
if (!src && !attribute(node, 'srcset')) continue;
|
|
423
423
|
const alt = attribute(node, 'alt');
|
|
424
|
+
const width = Number(attribute(node, 'width'));
|
|
425
|
+
const height = Number(attribute(node, 'height'));
|
|
424
426
|
images.push({
|
|
425
427
|
src: (resolveUrl(src ?? '', baseUrl) ?? src ?? '').slice(0, 2048),
|
|
426
428
|
alt,
|
|
427
429
|
hasAlt: typeof alt === 'string',
|
|
428
430
|
decorative: attribute(node, 'role') === 'presentation' || alt === '',
|
|
431
|
+
lazy: (attribute(node, 'loading') ?? '').toLowerCase() === 'lazy',
|
|
432
|
+
hasDimensions: Number.isFinite(width) && width > 0 && Number.isFinite(height) && height > 0,
|
|
433
|
+
responsive: Boolean(attribute(node, 'srcset')),
|
|
429
434
|
});
|
|
430
435
|
}
|
|
431
436
|
|
|
@@ -524,12 +529,17 @@ export function analyzeHtml(html, pageUrl) {
|
|
|
524
529
|
alternateLinks.push({
|
|
525
530
|
rel,
|
|
526
531
|
type: (attribute(node, 'type') ?? '').toLowerCase(),
|
|
532
|
+
hreflang: attribute(node, 'hreflang'),
|
|
527
533
|
href: (resolveUrl(href, baseUrl) ?? href).slice(0, 2048),
|
|
528
534
|
});
|
|
529
535
|
}
|
|
530
536
|
if (rel.includes('me') && href) relMe.push((resolveUrl(href, baseUrl) ?? href).slice(0, 2048));
|
|
531
537
|
}
|
|
532
538
|
|
|
539
|
+
const hreflangs = alternateLinks
|
|
540
|
+
.filter((link) => link.rel.includes('alternate') && Boolean(link.hreflang))
|
|
541
|
+
.map((link) => link.hreflang);
|
|
542
|
+
|
|
533
543
|
const times = [];
|
|
534
544
|
for (const node of nodes) {
|
|
535
545
|
if (node.tag !== 'time') continue;
|
|
@@ -659,6 +669,7 @@ export function analyzeHtml(html, pageUrl) {
|
|
|
659
669
|
metasAuthor: meta.author ?? null,
|
|
660
670
|
bylines: [...new Set(bylines)],
|
|
661
671
|
alternateLinks,
|
|
672
|
+
hreflangs: [...new Set(hreflangs)],
|
|
662
673
|
relMe: [...new Set(relMe)],
|
|
663
674
|
times,
|
|
664
675
|
scriptBytes,
|
package/lib/report.js
CHANGED
|
@@ -291,6 +291,18 @@ export function renderAuditMarkdown(report, context = {}) {
|
|
|
291
291
|
lines.push(`检查项合计:通过 ${report.counts.pass} / 部分 ${report.counts.warn} / 失败 ${report.counts.fail} / 不适用 ${report.counts.skip}`);
|
|
292
292
|
lines.push('');
|
|
293
293
|
|
|
294
|
+
if (Array.isArray(report.pillars) && report.pillars.length > 0) {
|
|
295
|
+
lines.push('## 三个支柱(同一批规则的第二个视图)');
|
|
296
|
+
lines.push('');
|
|
297
|
+
lines.push('| 支柱 | 分数 | 检查项 | 通过 | 部分 | 失败 |');
|
|
298
|
+
lines.push('|---|---|---|---|---|---|');
|
|
299
|
+
for (const pillar of report.pillars) {
|
|
300
|
+
const { pass, warn, fail } = pillar.counts;
|
|
301
|
+
lines.push(`| ${pillar.title} | ${pillar.score} | ${pillar.ruleCount} | ${pass} | ${warn} | ${fail} |`);
|
|
302
|
+
}
|
|
303
|
+
lines.push('');
|
|
304
|
+
}
|
|
305
|
+
|
|
294
306
|
if (Array.isArray(report.platforms) && report.platforms.length > 0) {
|
|
295
307
|
lines.push('## 平台适配(参考,不计入 Core 总分)');
|
|
296
308
|
lines.push('');
|
|
@@ -381,6 +393,12 @@ export function summarizeReport(report, options = {}) {
|
|
|
381
393
|
weight: dimension.weight,
|
|
382
394
|
score: dimension.score,
|
|
383
395
|
})),
|
|
396
|
+
pillars: (report.pillars ?? []).map((pillar) => ({
|
|
397
|
+
id: pillar.id,
|
|
398
|
+
title: pillar.title,
|
|
399
|
+
score: pillar.score,
|
|
400
|
+
counts: pillar.counts,
|
|
401
|
+
})),
|
|
384
402
|
platforms: (report.platforms ?? []).map((platform) => ({
|
|
385
403
|
id: platform.id,
|
|
386
404
|
title: platform.title,
|
package/lib/rules.js
CHANGED
|
@@ -12,7 +12,33 @@
|
|
|
12
12
|
* - skip: excluded from the denominator (not applicable)
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
export const RUBRIC_VERSION = 'geo-rubric@
|
|
15
|
+
export const RUBRIC_VERSION = 'geo-rubric@2';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The three optimisation pillars industry tools report separately.
|
|
19
|
+
*
|
|
20
|
+
* They are a second view over the same rules, never a second score: a rule
|
|
21
|
+
* contributes to exactly one pillar, and the pillars explain which part of the
|
|
22
|
+
* problem a finding belongs to. Adding a pillar does not change the Core total,
|
|
23
|
+
* which stays the five-dimension weighted score.
|
|
24
|
+
*/
|
|
25
|
+
export const PILLARS = [
|
|
26
|
+
{
|
|
27
|
+
id: 'seo',
|
|
28
|
+
title: 'SEO',
|
|
29
|
+
summary: '传统搜索引擎:抓取、索引、元数据、规范 URL 与可发现性。',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'aeo',
|
|
33
|
+
title: 'AEO',
|
|
34
|
+
summary: '答案引擎:语音助手与摘要场景需要的可回答结构、问答与实体。',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'geo',
|
|
38
|
+
title: 'GEO',
|
|
39
|
+
summary: '生成式引擎:AI 爬虫策略、机器说明书、可引用性与时效。',
|
|
40
|
+
},
|
|
41
|
+
];
|
|
16
42
|
|
|
17
43
|
export const DIMENSIONS = [
|
|
18
44
|
{
|
|
@@ -209,6 +235,7 @@ export const RULES = [
|
|
|
209
235
|
// ---------------------------------------------------------------- 可发现性
|
|
210
236
|
{
|
|
211
237
|
id: 'disc.robots-present',
|
|
238
|
+
pillar: 'seo',
|
|
212
239
|
dimension: 'discoverability',
|
|
213
240
|
weight: 3,
|
|
214
241
|
title: 'robots.txt 可访问',
|
|
@@ -221,6 +248,7 @@ export const RULES = [
|
|
|
221
248
|
},
|
|
222
249
|
{
|
|
223
250
|
id: 'disc.robots-not-blocking-site',
|
|
251
|
+
pillar: 'seo',
|
|
224
252
|
dimension: 'discoverability',
|
|
225
253
|
weight: 4,
|
|
226
254
|
title: 'robots.txt 未封禁站点',
|
|
@@ -238,6 +266,7 @@ export const RULES = [
|
|
|
238
266
|
},
|
|
239
267
|
{
|
|
240
268
|
id: 'disc.ai-crawler-policy',
|
|
269
|
+
pillar: 'geo',
|
|
241
270
|
dimension: 'discoverability',
|
|
242
271
|
weight: 3,
|
|
243
272
|
title: 'AI 爬虫策略明确',
|
|
@@ -256,6 +285,7 @@ export const RULES = [
|
|
|
256
285
|
},
|
|
257
286
|
{
|
|
258
287
|
id: 'disc.googlebot-accessible',
|
|
288
|
+
pillar: 'seo',
|
|
259
289
|
dimension: 'discoverability',
|
|
260
290
|
weight: 3,
|
|
261
291
|
title: 'Googlebot 可抓取',
|
|
@@ -271,6 +301,7 @@ export const RULES = [
|
|
|
271
301
|
},
|
|
272
302
|
{
|
|
273
303
|
id: 'disc.sitemap-present',
|
|
304
|
+
pillar: 'seo',
|
|
274
305
|
dimension: 'discoverability',
|
|
275
306
|
weight: 3,
|
|
276
307
|
title: 'XML sitemap 可用',
|
|
@@ -285,6 +316,7 @@ export const RULES = [
|
|
|
285
316
|
},
|
|
286
317
|
{
|
|
287
318
|
id: 'disc.sitemap-declared',
|
|
319
|
+
pillar: 'seo',
|
|
288
320
|
dimension: 'discoverability',
|
|
289
321
|
weight: 2,
|
|
290
322
|
title: 'sitemap 已声明',
|
|
@@ -301,6 +333,7 @@ export const RULES = [
|
|
|
301
333
|
},
|
|
302
334
|
{
|
|
303
335
|
id: 'disc.sitemap-covers-pages',
|
|
336
|
+
pillar: 'seo',
|
|
304
337
|
dimension: 'discoverability',
|
|
305
338
|
weight: 2,
|
|
306
339
|
title: 'sitemap 覆盖已抓取页面',
|
|
@@ -320,6 +353,7 @@ export const RULES = [
|
|
|
320
353
|
},
|
|
321
354
|
{
|
|
322
355
|
id: 'disc.indexable',
|
|
356
|
+
pillar: 'seo',
|
|
323
357
|
dimension: 'discoverability',
|
|
324
358
|
weight: 3,
|
|
325
359
|
title: '入口页可索引',
|
|
@@ -339,6 +373,7 @@ export const RULES = [
|
|
|
339
373
|
},
|
|
340
374
|
{
|
|
341
375
|
id: 'disc.canonical',
|
|
376
|
+
pillar: 'seo',
|
|
342
377
|
dimension: 'discoverability',
|
|
343
378
|
weight: 2,
|
|
344
379
|
title: 'canonical 自指且为绝对地址',
|
|
@@ -354,6 +389,7 @@ export const RULES = [
|
|
|
354
389
|
},
|
|
355
390
|
{
|
|
356
391
|
id: 'disc.internal-links',
|
|
392
|
+
pillar: 'seo',
|
|
357
393
|
dimension: 'discoverability',
|
|
358
394
|
weight: 3,
|
|
359
395
|
title: '入口页内链充分',
|
|
@@ -371,6 +407,7 @@ export const RULES = [
|
|
|
371
407
|
// ---------------------------------------------------------------- 可解析性
|
|
372
408
|
{
|
|
373
409
|
id: 'parse.title',
|
|
410
|
+
pillar: 'seo',
|
|
374
411
|
dimension: 'parsability',
|
|
375
412
|
weight: 3,
|
|
376
413
|
title: '<title> 长度合适',
|
|
@@ -385,6 +422,7 @@ export const RULES = [
|
|
|
385
422
|
},
|
|
386
423
|
{
|
|
387
424
|
id: 'parse.meta-description',
|
|
425
|
+
pillar: 'seo',
|
|
388
426
|
dimension: 'parsability',
|
|
389
427
|
weight: 2,
|
|
390
428
|
title: 'meta description 存在且合适',
|
|
@@ -400,6 +438,7 @@ export const RULES = [
|
|
|
400
438
|
},
|
|
401
439
|
{
|
|
402
440
|
id: 'parse.lang',
|
|
441
|
+
pillar: 'seo',
|
|
403
442
|
dimension: 'parsability',
|
|
404
443
|
weight: 1,
|
|
405
444
|
title: '<html lang> 已声明',
|
|
@@ -412,6 +451,7 @@ export const RULES = [
|
|
|
412
451
|
},
|
|
413
452
|
{
|
|
414
453
|
id: 'parse.h1',
|
|
454
|
+
pillar: 'seo',
|
|
415
455
|
dimension: 'parsability',
|
|
416
456
|
weight: 2,
|
|
417
457
|
title: '唯一且非空的主标题',
|
|
@@ -426,6 +466,7 @@ export const RULES = [
|
|
|
426
466
|
},
|
|
427
467
|
{
|
|
428
468
|
id: 'parse.heading-order',
|
|
469
|
+
pillar: 'seo',
|
|
429
470
|
dimension: 'parsability',
|
|
430
471
|
weight: 2,
|
|
431
472
|
title: '标题层级连续',
|
|
@@ -449,6 +490,7 @@ export const RULES = [
|
|
|
449
490
|
},
|
|
450
491
|
{
|
|
451
492
|
id: 'parse.semantics',
|
|
493
|
+
pillar: 'aeo',
|
|
452
494
|
dimension: 'parsability',
|
|
453
495
|
weight: 2,
|
|
454
496
|
title: '语义化正文容器',
|
|
@@ -462,6 +504,7 @@ export const RULES = [
|
|
|
462
504
|
},
|
|
463
505
|
{
|
|
464
506
|
id: 'parse.raw-content',
|
|
507
|
+
pillar: 'aeo',
|
|
465
508
|
dimension: 'parsability',
|
|
466
509
|
weight: 3,
|
|
467
510
|
title: '无 JS 也能读到正文',
|
|
@@ -476,6 +519,7 @@ export const RULES = [
|
|
|
476
519
|
},
|
|
477
520
|
{
|
|
478
521
|
id: 'parse.pages-with-content',
|
|
522
|
+
pillar: 'aeo',
|
|
479
523
|
dimension: 'parsability',
|
|
480
524
|
weight: 2,
|
|
481
525
|
title: '被抓取页面普遍含正文',
|
|
@@ -492,6 +536,7 @@ export const RULES = [
|
|
|
492
536
|
},
|
|
493
537
|
{
|
|
494
538
|
id: 'parse.duplicate-metadata',
|
|
539
|
+
pillar: 'seo',
|
|
495
540
|
dimension: 'parsability',
|
|
496
541
|
weight: 2,
|
|
497
542
|
title: '页面标题/描述不重复',
|
|
@@ -518,6 +563,7 @@ export const RULES = [
|
|
|
518
563
|
},
|
|
519
564
|
{
|
|
520
565
|
id: 'parse.image-alt',
|
|
566
|
+
pillar: 'seo',
|
|
521
567
|
dimension: 'parsability',
|
|
522
568
|
weight: 2,
|
|
523
569
|
title: '图片 alt 覆盖',
|
|
@@ -534,6 +580,7 @@ export const RULES = [
|
|
|
534
580
|
},
|
|
535
581
|
{
|
|
536
582
|
id: 'parse.jsonld-syntax',
|
|
583
|
+
pillar: 'aeo',
|
|
537
584
|
dimension: 'parsability',
|
|
538
585
|
weight: 2,
|
|
539
586
|
title: 'JSON-LD 语法有效',
|
|
@@ -549,6 +596,7 @@ export const RULES = [
|
|
|
549
596
|
},
|
|
550
597
|
{
|
|
551
598
|
id: 'parse.link-text',
|
|
599
|
+
pillar: 'seo',
|
|
552
600
|
dimension: 'parsability',
|
|
553
601
|
weight: 1,
|
|
554
602
|
title: '内链锚文本有描述性',
|
|
@@ -572,6 +620,7 @@ export const RULES = [
|
|
|
572
620
|
// ---------------------------------------------------------------- 可引用性
|
|
573
621
|
{
|
|
574
622
|
id: 'cite.qa-structure',
|
|
623
|
+
pillar: 'aeo',
|
|
575
624
|
dimension: 'citability',
|
|
576
625
|
weight: 3,
|
|
577
626
|
title: '问答结构',
|
|
@@ -588,6 +637,7 @@ export const RULES = [
|
|
|
588
637
|
},
|
|
589
638
|
{
|
|
590
639
|
id: 'cite.summary',
|
|
640
|
+
pillar: 'aeo',
|
|
591
641
|
dimension: 'citability',
|
|
592
642
|
weight: 2,
|
|
593
643
|
title: '摘要 / TL;DR 区块',
|
|
@@ -600,6 +650,7 @@ export const RULES = [
|
|
|
600
650
|
},
|
|
601
651
|
{
|
|
602
652
|
id: 'cite.numeric-evidence',
|
|
653
|
+
pillar: 'geo',
|
|
603
654
|
dimension: 'citability',
|
|
604
655
|
weight: 3,
|
|
605
656
|
title: '可验证的数字证据',
|
|
@@ -614,6 +665,7 @@ export const RULES = [
|
|
|
614
665
|
},
|
|
615
666
|
{
|
|
616
667
|
id: 'cite.authority-sources',
|
|
668
|
+
pillar: 'geo',
|
|
617
669
|
dimension: 'citability',
|
|
618
670
|
weight: 2,
|
|
619
671
|
title: '引用权威来源',
|
|
@@ -628,6 +680,7 @@ export const RULES = [
|
|
|
628
680
|
},
|
|
629
681
|
{
|
|
630
682
|
id: 'cite.freshness',
|
|
683
|
+
pillar: 'geo',
|
|
631
684
|
dimension: 'citability',
|
|
632
685
|
weight: 3,
|
|
633
686
|
title: '内容时效可判定',
|
|
@@ -646,6 +699,7 @@ export const RULES = [
|
|
|
646
699
|
},
|
|
647
700
|
{
|
|
648
701
|
id: 'cite.author',
|
|
702
|
+
pillar: 'geo',
|
|
649
703
|
dimension: 'citability',
|
|
650
704
|
weight: 2,
|
|
651
705
|
title: '作者署名可识别',
|
|
@@ -663,6 +717,7 @@ export const RULES = [
|
|
|
663
717
|
},
|
|
664
718
|
{
|
|
665
719
|
id: 'cite.anchors',
|
|
720
|
+
pillar: 'aeo',
|
|
666
721
|
dimension: 'citability',
|
|
667
722
|
weight: 2,
|
|
668
723
|
title: '章节可锚点引用',
|
|
@@ -681,6 +736,7 @@ export const RULES = [
|
|
|
681
736
|
},
|
|
682
737
|
{
|
|
683
738
|
id: 'cite.structure',
|
|
739
|
+
pillar: 'aeo',
|
|
684
740
|
dimension: 'citability',
|
|
685
741
|
weight: 3,
|
|
686
742
|
title: '结构化排版与短段落',
|
|
@@ -702,6 +758,7 @@ export const RULES = [
|
|
|
702
758
|
},
|
|
703
759
|
{
|
|
704
760
|
id: 'cite.snippet-ready',
|
|
761
|
+
pillar: 'aeo',
|
|
705
762
|
dimension: 'citability',
|
|
706
763
|
weight: 3,
|
|
707
764
|
title: '小节答案可直接摘录',
|
|
@@ -718,6 +775,7 @@ export const RULES = [
|
|
|
718
775
|
// ---------------------------------------------------------------- 实体与信任
|
|
719
776
|
{
|
|
720
777
|
id: 'trust.https',
|
|
778
|
+
pillar: 'seo',
|
|
721
779
|
dimension: 'trust',
|
|
722
780
|
weight: 3,
|
|
723
781
|
title: '全站 HTTPS',
|
|
@@ -735,6 +793,7 @@ export const RULES = [
|
|
|
735
793
|
},
|
|
736
794
|
{
|
|
737
795
|
id: 'trust.org-schema',
|
|
796
|
+
pillar: 'aeo',
|
|
738
797
|
dimension: 'trust',
|
|
739
798
|
weight: 3,
|
|
740
799
|
title: '组织实体 schema',
|
|
@@ -749,6 +808,7 @@ export const RULES = [
|
|
|
749
808
|
},
|
|
750
809
|
{
|
|
751
810
|
id: 'trust.contact',
|
|
811
|
+
pillar: 'aeo',
|
|
752
812
|
dimension: 'trust',
|
|
753
813
|
weight: 2,
|
|
754
814
|
title: '联系方式可找到',
|
|
@@ -766,6 +826,7 @@ export const RULES = [
|
|
|
766
826
|
},
|
|
767
827
|
{
|
|
768
828
|
id: 'trust.about',
|
|
829
|
+
pillar: 'aeo',
|
|
769
830
|
dimension: 'trust',
|
|
770
831
|
weight: 2,
|
|
771
832
|
title: 'About 页面可核实身份',
|
|
@@ -783,6 +844,7 @@ export const RULES = [
|
|
|
783
844
|
},
|
|
784
845
|
{
|
|
785
846
|
id: 'trust.security-headers',
|
|
847
|
+
pillar: 'seo',
|
|
786
848
|
dimension: 'trust',
|
|
787
849
|
weight: 2,
|
|
788
850
|
title: '基础安全响应头',
|
|
@@ -810,6 +872,7 @@ export const RULES = [
|
|
|
810
872
|
},
|
|
811
873
|
{
|
|
812
874
|
id: 'trust.privacy',
|
|
875
|
+
pillar: 'aeo',
|
|
813
876
|
dimension: 'trust',
|
|
814
877
|
weight: 1,
|
|
815
878
|
title: '隐私政策可达',
|
|
@@ -822,6 +885,7 @@ export const RULES = [
|
|
|
822
885
|
},
|
|
823
886
|
{
|
|
824
887
|
id: 'trust.sameas',
|
|
888
|
+
pillar: 'geo',
|
|
825
889
|
dimension: 'trust',
|
|
826
890
|
weight: 2,
|
|
827
891
|
title: '外部身份背书',
|
|
@@ -836,9 +900,163 @@ export const RULES = [
|
|
|
836
900
|
},
|
|
837
901
|
},
|
|
838
902
|
|
|
903
|
+
{
|
|
904
|
+
id: 'seo.viewport',
|
|
905
|
+
pillar: 'seo',
|
|
906
|
+
dimension: 'parsability',
|
|
907
|
+
weight: 2,
|
|
908
|
+
title: '移动端视口声明',
|
|
909
|
+
fix: '在 <head> 输出 <meta name="viewport" content="width=device-width, initial-scale=1">;缺少它会让移动端按桌面宽度渲染。',
|
|
910
|
+
evaluate({ primary }) {
|
|
911
|
+
if (!primary) return fail('未抓取到 HTML 入口页');
|
|
912
|
+
const viewport = primary.facts.metaViewport ?? '';
|
|
913
|
+
if (!viewport) return fail('缺少 meta viewport');
|
|
914
|
+
if (/width\s*=\s*device-width/i.test(viewport)) return pass(viewport.slice(0, 80));
|
|
915
|
+
return warn(`viewport 未使用 device-width:${viewport.slice(0, 80)}`);
|
|
916
|
+
},
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
id: 'seo.image-dimensions',
|
|
920
|
+
pillar: 'seo',
|
|
921
|
+
dimension: 'parsability',
|
|
922
|
+
weight: 2,
|
|
923
|
+
title: '图片声明宽高',
|
|
924
|
+
fix: '为 <img> 写上 width/height 或使用 aspect-ratio,避免加载时布局跳动(CLS)。',
|
|
925
|
+
evaluate({ factsPages }) {
|
|
926
|
+
const stats = imageStats(factsPages);
|
|
927
|
+
if (stats.total === 0) return skip('未使用图片');
|
|
928
|
+
let withDimensions = 0;
|
|
929
|
+
for (const page of factsPages) {
|
|
930
|
+
for (const image of page.facts.images) if (image.hasDimensions) withDimensions += 1;
|
|
931
|
+
}
|
|
932
|
+
const ratio = withDimensions / stats.total;
|
|
933
|
+
const evidence = `${withDimensions}/${stats.total} 张图片声明了宽高`;
|
|
934
|
+
if (ratio >= 0.8) return pass(evidence);
|
|
935
|
+
if (ratio >= 0.4) return warn(evidence);
|
|
936
|
+
return fail(evidence);
|
|
937
|
+
},
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
id: 'seo.image-lazy',
|
|
941
|
+
pillar: 'seo',
|
|
942
|
+
dimension: 'parsability',
|
|
943
|
+
weight: 1,
|
|
944
|
+
title: '首屏外图片懒加载',
|
|
945
|
+
fix: '给首屏以下的图片加 loading="lazy",首屏图不要加,避免延迟最大内容渲染。',
|
|
946
|
+
evaluate({ primary }) {
|
|
947
|
+
if (!primary) return fail('未抓取到 HTML 入口页');
|
|
948
|
+
const images = primary.facts.images ?? [];
|
|
949
|
+
if (images.length === 0) return skip('入口页没有图片');
|
|
950
|
+
const lazy = images.filter((image) => image.lazy).length;
|
|
951
|
+
if (lazy > 0) return pass(`${lazy}/${images.length} 张图片使用 loading="lazy"`);
|
|
952
|
+
if (images.length <= 2) return skip(`入口页只有 ${images.length} 张图片,懒加载意义有限`);
|
|
953
|
+
return warn(`${images.length} 张图片都没有 loading="lazy"`);
|
|
954
|
+
},
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
id: 'seo.url-structure',
|
|
958
|
+
pillar: 'seo',
|
|
959
|
+
dimension: 'discoverability',
|
|
960
|
+
weight: 2,
|
|
961
|
+
title: 'URL 结构可读',
|
|
962
|
+
fix: '用短、含语义词的路径;避免大写、下划线、过长 query 串与深层嵌套(超过 4 层)。',
|
|
963
|
+
evaluate({ pages }) {
|
|
964
|
+
const html = pages.filter((page) => page.facts);
|
|
965
|
+
if (html.length === 0) return fail('未抓取到 HTML 页面');
|
|
966
|
+
const problems = [];
|
|
967
|
+
for (const page of html) {
|
|
968
|
+
const path = page.path ?? '/';
|
|
969
|
+
const depth = path.split('/').filter(Boolean).length;
|
|
970
|
+
if (depth > 4) problems.push(`${path}(${depth} 层)`);
|
|
971
|
+
else if (/[A-Z]/.test(path)) problems.push(`${path}(含大写)`);
|
|
972
|
+
else if (/_/.test(path)) problems.push(`${path}(含下划线)`);
|
|
973
|
+
else if ((page.facts.url ?? '').length > 120) problems.push(`${path}(过长)`);
|
|
974
|
+
}
|
|
975
|
+
if (problems.length === 0) return pass(`${html.length} 个页面路径结构清晰`);
|
|
976
|
+
if (problems.length <= Math.ceil(html.length / 2)) return warn(`${problems.length} 个页面路径可优化:${problems.slice(0, 3).join('、')}`);
|
|
977
|
+
return fail(`${problems.length}/${html.length} 个页面路径可优化`);
|
|
978
|
+
},
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
id: 'seo.hreflang',
|
|
982
|
+
pillar: 'seo',
|
|
983
|
+
dimension: 'discoverability',
|
|
984
|
+
weight: 1,
|
|
985
|
+
title: '多语言 hreflang',
|
|
986
|
+
fix: '若站点有多个语言版本,用 <link rel="alternate" hreflang="..."> 标注互指;单语言站点可忽略。',
|
|
987
|
+
evaluate({ primary }) {
|
|
988
|
+
if (!primary) return fail('未抓取到 HTML 入口页');
|
|
989
|
+
if (primary.facts.hreflangs.length > 0) {
|
|
990
|
+
return pass(`${primary.facts.hreflangs.length} 个 hreflang:${primary.facts.hreflangs.slice(0, 5).join(', ')}`);
|
|
991
|
+
}
|
|
992
|
+
return skip('未声明 hreflang;单语言站点不需要');
|
|
993
|
+
},
|
|
994
|
+
},
|
|
995
|
+
{
|
|
996
|
+
id: 'aeo.answer-first',
|
|
997
|
+
pillar: 'aeo',
|
|
998
|
+
dimension: 'citability',
|
|
999
|
+
weight: 3,
|
|
1000
|
+
title: '正文开头给出直接答案',
|
|
1001
|
+
fix: '在第一个 h1 之后紧跟一段 2–4 句的直接回答,再展开解释;语音助手与摘要更依赖开头的自足段落。',
|
|
1002
|
+
evaluate({ primary }) {
|
|
1003
|
+
if (!primary) return fail('未抓取到 HTML 入口页');
|
|
1004
|
+
const sections = primary.facts.sections ?? [];
|
|
1005
|
+
// Bylines and kickers are short paragraphs before the real answer; skip
|
|
1006
|
+
// them and judge the first substantial paragraph near the top instead.
|
|
1007
|
+
const candidates = sections
|
|
1008
|
+
.slice(0, 3)
|
|
1009
|
+
.flatMap((section) => section.paragraphs)
|
|
1010
|
+
.filter((text) => text.length > 0);
|
|
1011
|
+
const first = candidates.find((text) => text.length >= 25);
|
|
1012
|
+
if (!first) {
|
|
1013
|
+
const longest = candidates.sort((a, b) => b.length - a.length)[0] ?? '';
|
|
1014
|
+
return fail(`开头没有可作答案的段落(最长 ${longest.length} 字)`);
|
|
1015
|
+
}
|
|
1016
|
+
if (first.length >= 60) return pass(`开头段落 ${first.length} 字:${first.slice(0, 60)}…`);
|
|
1017
|
+
return warn(`开头段落仅 ${first.length} 字,建议扩成 2–4 句直接回答`);
|
|
1018
|
+
},
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
id: 'aeo.question-density',
|
|
1022
|
+
pillar: 'aeo',
|
|
1023
|
+
dimension: 'citability',
|
|
1024
|
+
weight: 2,
|
|
1025
|
+
title: '问句式标题覆盖',
|
|
1026
|
+
fix: '用用户真实的提问作为 h2/h3(“怎么…”“为什么…”“是否…”),一段回答一个问题。',
|
|
1027
|
+
evaluate({ primary }) {
|
|
1028
|
+
if (!primary) return fail('未抓取到 HTML 入口页');
|
|
1029
|
+
const headings = primary.facts.headings.filter((heading) => heading.level >= 2);
|
|
1030
|
+
if (headings.length === 0) return fail('入口页没有二级标题');
|
|
1031
|
+
const questions = primary.facts.questionHeadings.length;
|
|
1032
|
+
const ratio = questions / headings.length;
|
|
1033
|
+
const evidence = `${questions}/${headings.length} 个二级标题是问句`;
|
|
1034
|
+
if (questions >= 3 && ratio >= 0.25) return pass(evidence);
|
|
1035
|
+
if (questions >= 1) return warn(evidence);
|
|
1036
|
+
return fail(evidence);
|
|
1037
|
+
},
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
id: 'aeo.definition-list',
|
|
1041
|
+
pillar: 'aeo',
|
|
1042
|
+
dimension: 'citability',
|
|
1043
|
+
weight: 1,
|
|
1044
|
+
title: '术语与要点可抽取',
|
|
1045
|
+
fix: '用 <dl>/<table>/<ul> 承载定义、对比与步骤;纯段落堆叠不易被答案引擎抽成条目。',
|
|
1046
|
+
evaluate({ primary }) {
|
|
1047
|
+
if (!primary) return fail('未抓取到 HTML 入口页');
|
|
1048
|
+
const { tables, lists, definitionLists } = primary.facts.counts;
|
|
1049
|
+
const total = tables + lists + definitionLists;
|
|
1050
|
+
if (total >= 3) return pass(`${tables} 表格 / ${lists} 列表 / ${definitionLists} 定义列表`);
|
|
1051
|
+
if (total >= 1) return warn(`仅 ${total} 处结构化列表或表格`);
|
|
1052
|
+
return fail('没有列表、表格或定义列表');
|
|
1053
|
+
},
|
|
1054
|
+
},
|
|
1055
|
+
|
|
839
1056
|
// ---------------------------------------------------------------- 机器说明书
|
|
840
1057
|
{
|
|
841
1058
|
id: 'manifest.llms-txt',
|
|
1059
|
+
pillar: 'geo',
|
|
842
1060
|
dimension: 'manifest',
|
|
843
1061
|
weight: 2,
|
|
844
1062
|
title: 'llms.txt(可选,非 Google 必需)',
|
|
@@ -852,6 +1070,7 @@ export const RULES = [
|
|
|
852
1070
|
},
|
|
853
1071
|
{
|
|
854
1072
|
id: 'manifest.llms-structure',
|
|
1073
|
+
pillar: 'geo',
|
|
855
1074
|
dimension: 'manifest',
|
|
856
1075
|
weight: 1,
|
|
857
1076
|
title: 'llms.txt 结构完整(可选)',
|
|
@@ -866,6 +1085,7 @@ export const RULES = [
|
|
|
866
1085
|
},
|
|
867
1086
|
{
|
|
868
1087
|
id: 'manifest.structured-breadth',
|
|
1088
|
+
pillar: 'geo',
|
|
869
1089
|
dimension: 'manifest',
|
|
870
1090
|
weight: 2,
|
|
871
1091
|
title: 'schema.org 类型覆盖面(富结果)',
|
|
@@ -880,6 +1100,7 @@ export const RULES = [
|
|
|
880
1100
|
},
|
|
881
1101
|
{
|
|
882
1102
|
id: 'manifest.og-cards',
|
|
1103
|
+
pillar: 'seo',
|
|
883
1104
|
dimension: 'manifest',
|
|
884
1105
|
weight: 1,
|
|
885
1106
|
title: 'OpenGraph / 分享卡片',
|
|
@@ -895,6 +1116,7 @@ export const RULES = [
|
|
|
895
1116
|
},
|
|
896
1117
|
{
|
|
897
1118
|
id: 'manifest.feed',
|
|
1119
|
+
pillar: 'seo',
|
|
898
1120
|
dimension: 'manifest',
|
|
899
1121
|
weight: 1,
|
|
900
1122
|
title: '内容 feed(可选)',
|
|
@@ -909,6 +1131,7 @@ export const RULES = [
|
|
|
909
1131
|
},
|
|
910
1132
|
{
|
|
911
1133
|
id: 'manifest.link-hints',
|
|
1134
|
+
pillar: 'geo',
|
|
912
1135
|
dimension: 'manifest',
|
|
913
1136
|
weight: 1,
|
|
914
1137
|
title: 'HTTP Link / Markdown 入口提示(可选)',
|
|
@@ -924,6 +1147,7 @@ export const RULES = [
|
|
|
924
1147
|
},
|
|
925
1148
|
{
|
|
926
1149
|
id: 'manifest.entity-id',
|
|
1150
|
+
pillar: 'geo',
|
|
927
1151
|
dimension: 'manifest',
|
|
928
1152
|
weight: 1,
|
|
929
1153
|
title: '实体 @id 稳定',
|
package/lib/score.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { evaluatePlatforms } from './platforms/index.js';
|
|
12
|
-
import { DIMENSIONS, RULES, RUBRIC_VERSION, evaluateRules } from './rules.js';
|
|
12
|
+
import { DIMENSIONS, PILLARS, RULES, RUBRIC_VERSION, evaluateRules } from './rules.js';
|
|
13
13
|
|
|
14
14
|
export const SCORE_VERSION = 'score@1';
|
|
15
15
|
|
|
@@ -108,6 +108,31 @@ export function scoreScan(scan, options = {}) {
|
|
|
108
108
|
skip: findings.filter((finding) => finding.status === 'skip').length,
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
+
// Pillars are a second view over the same findings: each rule belongs to
|
|
112
|
+
// exactly one pillar, and the pillar score is that subset's weighted ratio.
|
|
113
|
+
const pillars = PILLARS.map((pillar) => {
|
|
114
|
+
const own = findings.filter((finding) => {
|
|
115
|
+
const rule = RULES.find((entry) => entry.id === finding.id);
|
|
116
|
+
return rule?.pillar === pillar.id;
|
|
117
|
+
});
|
|
118
|
+
const applicable = own.reduce((sum, finding) => sum + (finding.status === 'skip' ? 0 : finding.weight), 0);
|
|
119
|
+
const earned = own.reduce((sum, finding) => sum + finding.weight * (STATUS_FACTOR[finding.status] ?? 0), 0);
|
|
120
|
+
return {
|
|
121
|
+
id: pillar.id,
|
|
122
|
+
title: pillar.title,
|
|
123
|
+
summary: pillar.summary,
|
|
124
|
+
score: applicable > 0 ? round1((earned / applicable) * 100) : 0,
|
|
125
|
+
scored: applicable > 0,
|
|
126
|
+
ruleCount: own.length,
|
|
127
|
+
counts: {
|
|
128
|
+
pass: own.filter((finding) => finding.status === 'pass').length,
|
|
129
|
+
warn: own.filter((finding) => finding.status === 'warn').length,
|
|
130
|
+
fail: own.filter((finding) => finding.status === 'fail').length,
|
|
131
|
+
skip: own.filter((finding) => finding.status === 'skip').length,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
|
|
111
136
|
const dimensionWeight = new Map(DIMENSIONS.map((dimension) => [dimension.id, dimension.weight]));
|
|
112
137
|
const actions = findings
|
|
113
138
|
.filter((finding) => finding.status === 'fail' || finding.status === 'warn')
|
|
@@ -135,6 +160,7 @@ export function scoreScan(scan, options = {}) {
|
|
|
135
160
|
grade: grade.grade,
|
|
136
161
|
gradeLabel: grade.label,
|
|
137
162
|
dimensions,
|
|
163
|
+
pillars,
|
|
138
164
|
counts,
|
|
139
165
|
findings,
|
|
140
166
|
actions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobola/dsh-geo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Read-only, reproducible GEO/SEO website audits for DeepSeek Harness: inspect crawlability and citation-ready structure, return evidence and prioritized fixes, and never edit the site or promise rankings.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|