@cobola/dsh-geo 0.9.0 → 0.11.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 CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0 - 2026-11-29
4
+
5
+ ### Features
6
+
7
+ - Add schema.org completeness checking: every typed entity is compared against
8
+ the properties its type actually needs (`Article` needs headline/author/
9
+ datePublished, `Product` needs name/offers, …), and the gap is named.
10
+ - Add page-type/schema matching. The inference uses observable signals only
11
+ (URL path, cart copy, FAQ entities) and is reported as a warning, never a hard
12
+ failure, because inference can be wrong.
13
+ - Add an optional WebMCP check (W3C Web Machine Learning CG draft): forms
14
+ declaring `toolname`/`tooldescription` are recognised. Plain search forms
15
+ report `skip`, not a defect.
16
+ - Rubric is now 56 checks: SEO 28, AEO 16, GEO 12.
17
+
18
+ ### Notes
19
+
20
+ - Google rich-result membership is encoded separately from schema.org
21
+ requirements, so the audit never implies a rich result it cannot verify.
22
+
23
+
24
+ ## 0.10.0 - 2026-11-29
25
+
26
+ ### Features
27
+
28
+ - Add the SEO / AEO / GEO pillar view. Every rule now declares one pillar, and
29
+ the pillar scores appear in the CLI, audit report, tool result and in-chat card.
30
+ Pillars are a second view over the same findings: they never change the Core
31
+ total.
32
+ - Add eight checks: viewport declaration, image dimensions, lazy loading, URL
33
+ structure, hreflang (SEO); answer-first opening, question-heading density and
34
+ extractable term blocks (AEO).
35
+ - Rubric is now 53 checks: SEO 26, AEO 16, GEO 11.
36
+
37
+ ### Notes
38
+
39
+ - `seo.hreflang` reports `skip` on single-language sites instead of penalising
40
+ them.
41
+
42
+
3
43
  ## 0.9.0 - 2026-11-29
4
44
 
5
45
  ### Features
package/README.md CHANGED
@@ -167,7 +167,7 @@ dsh-geo ci https://journal123.com \
167
167
 
168
168
  ```yaml
169
169
  - uses: actions/checkout@v4
170
- - uses: cobola/dsh-geo@v0.9.0
170
+ - uses: cobola/dsh-geo@v0.11.0
171
171
  with:
172
172
  url: https://journal123.com
173
173
  baseline: geo-baseline.json
@@ -199,7 +199,7 @@ CLI 也随 npm 包提供:`npx @cobola/dsh-geo --help`;完整参数见 `dsh-g
199
199
  | 实体与信任 | 15 | 站点身份是否可核实(HTTPS、组织实体、联系方式、安全头) |
200
200
  | 机器说明书 | 15 | llms.txt、结构化数据、OpenGraph、feed、Link 提示 |
201
201
 
202
- 45 条可审计检查,维度内按权重归一化;`pass` 计 1、`warn` 计 0.5、`fail` 计 0、`skip` 移出分母。总分是五维加权平均。完整规则、阈值与修复建议见 **[docs/RULES.md](docs/RULES.md)**(由 `lib/rules.js` 生成)。
202
+ 56 条可审计检查,维度内按权重归一化;`pass` 计 1、`warn` 计 0.5、`fail` 计 0、`skip` 移出分母。总分是五维加权平均。完整规则、阈值与修复建议见 **[docs/RULES.md](docs/RULES.md)**(由 `lib/rules.js` 生成)。
203
203
 
204
204
  ### 内容生成器(可选)
205
205
 
@@ -275,6 +275,8 @@ lib/html.js 无依赖 HTML 解析与事实抽取
275
275
  lib/scan.js 抓取流程
276
276
  lib/rules.js 45 条 Core 规则(唯一事实源)
277
277
  lib/platforms/ 平台 profile(Bing、百度、OpenAI、Perplexity 已实现)
278
+ lib/schema.js schema.org 字段完整性、页面类型匹配
279
+ lib/generate.js llms.txt 与 FAQ JSON-LD 生成器
278
280
  lib/ci.js CI 审计、基线与质量门禁
279
281
  lib/mcp.js stdio MCP server(零依赖手写 JSON-RPC)
280
282
  bin/dsh-geo-mcp.js MCP 二进制入口
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
@@ -123,7 +123,7 @@ on:
123
123
 
124
124
  ```yaml
125
125
  - uses: actions/checkout@v4
126
- - uses: cobola/dsh-geo@v0.9.0
126
+ - uses: cobola/dsh-geo@v0.11.0
127
127
  with:
128
128
  url: https://journal123.com
129
129
  baseline: geo-baseline.json
package/docs/RULES.md CHANGED
@@ -1,4 +1,4 @@
1
- # GEO 评分规则(geo-rubric@1)
1
+ # GEO 评分规则(geo-rubric@3)
2
2
 
3
3
  本文件由 `scripts/gen-docs.mjs` 从 `lib/rules.js` 生成,请勿手工编辑。改规则后运行 `npm run docs`。
4
4
 
@@ -14,77 +14,88 @@
14
14
 
15
15
  ## 2. 规则表
16
16
 
17
- 共 45 条规则。每条规则的通过条件、证据格式与失败阈值都在 `lib/rules.js` 的 `evaluate()` 中,运行时会把证据写进报告(`findings[].evidence`),因此报告本身就能说明为什么得分。
17
+ 共 56 条规则,分归三个支柱:SEO 28 条、AEO 16 条、GEO 12 条。支柱是同一批规则的第二个视图,不改变 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",首屏图不要加,避免延迟最大内容渲染。 |
55
+ | `seo.schema-fields` | SEO | 3 | 结构化数据字段完整 | 按 schema.org 定义补齐必备属性:Article 要 headline/author/datePublished,Product 要 name 与 offers,Organization 要 name 与 url。 |
56
+ | `seo.schema-matches-page-type` | SEO | 2 | 页面类型与结构化数据匹配 | 内容页输出 Article/BlogPosting,商品页输出 Product,问答页输出 FAQPage;类型与内容不符会被忽略。 |
50
57
 
51
58
  ### 可引用性(25 分)
52
59
 
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 词的直接回答,再展开细节;避免先铺垫后给结论。 |
60
+ | 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
61
+ |---|---|---|---|---|
62
+ | `cite.qa-structure` | AEO | 3 | 问答结构 | 把用户真实提问写成 h2/h3,并用 FAQPage/HowTo 结构化数据标注问答对。 |
63
+ | `cite.summary` | AEO | 2 | 摘要 / TL;DR 区块 | 在正文开头加一段 2–4 句的摘要(class="summary" 或 TL;DR),让引用者能直接取用。 |
64
+ | `cite.numeric-evidence` | GEO | 3 | 可验证的数字证据 | 补充带单位的具体数字(百分比、耗时、样本量、版本号、日期),避免只有形容词。 |
65
+ | `cite.authority-sources` | GEO | 2 | 引用权威来源 | 在关键论断处链接一手来源(标准文档、官方文档、论文、政府/教育站点),并保持链接可访问。 |
66
+ | `cite.freshness` | GEO | 3 | 内容时效可判定 | 输出 datePublished/dateModified(JSON-LD 或 <time datetime>),并在正文中显示“最后更新日期”。 |
67
+ | `cite.author` | GEO | 2 | 作者署名可识别 | 在页面与 Article schema 中给出作者姓名、简介与主页;匿名内容很难被引用。 |
68
+ | `cite.anchors` | AEO | 2 | 章节可锚点引用 | 给每个 h2/h3 加语义化 id(如 id="geo-score"),方便引用到具体小节。 |
69
+ | `cite.structure` | AEO | 3 | 结构化排版与短段落 | 用表格、有序列表承载对比与步骤,段落控制在 120 词以内,便于模型截取。 |
70
+ | `cite.snippet-ready` | AEO | 3 | 小节答案可直接摘录 | 每个 h2 下紧跟 30–140 词的直接回答,再展开细节;避免先铺垫后给结论。 |
71
+ | `aeo.answer-first` | AEO | 3 | 正文开头给出直接答案 | 在第一个 h1 之后紧跟一段 2–4 句的直接回答,再展开解释;语音助手与摘要更依赖开头的自足段落。 |
72
+ | `aeo.question-density` | AEO | 2 | 问句式标题覆盖 | 用用户真实的提问作为 h2/h3(“怎么…”“为什么…”“是否…”),一段回答一个问题。 |
73
+ | `aeo.definition-list` | AEO | 1 | 术语与要点可抽取 | 用 <dl>/<table>/<ul> 承载定义、对比与步骤;纯段落堆叠不易被答案引擎抽成条目。 |
64
74
 
65
75
  ### 实体与信任(15 分)
66
76
 
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、维基数据等主页。 |
77
+ | 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
78
+ |---|---|---|---|---|
79
+ | `trust.https` | SEO | 3 | 全站 HTTPS | 启用 HTTPS,把 HTTP 301 到 HTTPS,并提交 HSTS。 |
80
+ | `trust.org-schema` | AEO | 3 | 组织实体 schema | 用 Organization/LocalBusiness JSON-LD 声明 name、url、logo、sameAs,帮助实体消歧与富结果;Google 表示生成式 AI 不要求特殊 schema。 |
81
+ | `trust.contact` | AEO | 2 | 联系方式可找到 | 提供 /contact 页面、mailto: 或 schema contactPoint,并保持信息与实体注册一致。 |
82
+ | `trust.about` | AEO | 2 | About 页面可核实身份 | 提供 /about 页面,写明团队、公司主体、所在地与联系方式。 |
83
+ | `trust.security-headers` | SEO | 2 | 基础安全响应头 | 至少配置 HSTS(HTTPS)、Content-Security-Policy、X-Content-Type-Options: nosniff、Referrer-Policy。 |
84
+ | `trust.privacy` | AEO | 1 | 隐私政策可达 | 添加隐私政策页面并从页脚链接,说明数据用途与联系方式。 |
85
+ | `trust.sameas` | GEO | 2 | 外部身份背书 | 在 Organization sameAs 或 <link rel="me"> 中列出官方 GitHub、LinkedIn、X、维基数据等主页。 |
76
86
 
77
87
  ### 机器说明书(15 分)
78
88
 
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。 |
89
+ | 规则 ID | 支柱 | 权重 | 检查项 | 修复建议 |
90
+ |---|---|---|---|---|
91
+ | `geo.agent-tools` | GEO | 2 | 可选:WebMCP agent 工具声明 | 可选能力:若希望 agent 直接调用站内功能,给 <form> 加 toolname/tooldescription(W3C WebMCP 草案);普通内容站不需要。 |
92
+ | `manifest.llms-txt` | GEO | 2 | llms.txt(可选,非 Google 必需) | 可选:若需要服务非 Google 的 agent/工具,可发布 llms.txt(# 标题 + ## 分节 + Markdown 链接)。Google Search 明确不使用 llms.txt,不要把它当作 Google 排名手段。 |
93
+ | `manifest.llms-structure` | GEO | 1 | llms.txt 结构完整(可选) | 若提供 llms.txt,至少包含 2 个 ## 分节和 3 个指向正文的 Markdown 链接。注意:Google Search 不使用该文件。 |
94
+ | `manifest.structured-breadth` | GEO | 2 | schema.org 类型覆盖面(富结果) | 按页面类型输出 schema(Organization/WebSite、Article、FAQPage、BreadcrumbList),用于富结果与实体消歧。Google 明确表示生成式 AI 不需要特殊 schema。 |
95
+ | `manifest.og-cards` | SEO | 1 | OpenGraph / 分享卡片 | 为每个页面输出 og:title、og:description、og:image(1200×630)与 og:url。 |
96
+ | `manifest.feed` | SEO | 1 | 内容 feed(可选) | 发布 RSS/Atom feed,并用 <link rel="alternate" type="application/rss+xml"> 暴露;它服务于订阅与分发,不是 Google AI 的要求。 |
97
+ | `manifest.link-hints` | GEO | 1 | HTTP Link / Markdown 入口提示(可选) | 可选:在响应头加 Link: </llms.txt>; rel="llms",或提供 text/markdown alternate。Google Search 不使用这些提示。 |
98
+ | `manifest.entity-id` | GEO | 1 | 实体 @id 稳定 | 给 Organization/WebSite 分配稳定的 @id(如 https://example.com/#organization),所有页面复用同一 @id。 |
88
99
 
89
100
  ## 3. fixture 与基线分数
90
101
 
@@ -93,8 +104,8 @@
93
104
  | fixture | 总分 | 等级 | 页数 | 说明 |
94
105
  |---|---|---|---|---|
95
106
  | `good-static` | 100.0 | A+ | 5 | 五维全部通过,用来证明满分可达 |
96
- | `bad-spa` | 30.5 | F | 1 | 正文只在 JavaScript 里,抓取器看到空壳 |
97
- | `bad-robots` | 77.4 | B | 5 | 内容可读;第三方 AI 爬虫封禁提示 warn,但 Googlebot 可抓取 |
107
+ | `bad-spa` | 32.4 | F | 1 | 正文只在 JavaScript 里,抓取器看到空壳 |
108
+ | `bad-robots` | 76.0 | B | 5 | 内容可读;第三方 AI 爬虫封禁提示 warn,但 Googlebot 可抓取 |
98
109
 
99
110
  任何规则或 fixture 的改动都会让这些数字变化,测试会立即失败。要更新基线,必须先确认改动是**有意的**,再同时修改 fixture 与测试中的期望值。
100
111
 
package/docs/index.json CHANGED
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "versions": [
29
29
  {
30
- "version": "0.9.0",
30
+ "version": "0.11.0",
31
31
  "source": {
32
32
  "type": "npm"
33
33
  },
@@ -23,7 +23,7 @@ jobs:
23
23
  - uses: actions/checkout@v4
24
24
 
25
25
  - name: Audit and compare against the committed baseline
26
- uses: cobola/dsh-geo@v0.9.0
26
+ uses: cobola/dsh-geo@v0.11.0
27
27
  with:
28
28
  url: https://journal123.com
29
29
  baseline: geo-baseline.json
@@ -15,7 +15,7 @@ jobs:
15
15
  - uses: actions/checkout@v4
16
16
 
17
17
  - name: Audit and write a baseline
18
- uses: cobola/dsh-geo@v0.9.0
18
+ uses: cobola/dsh-geo@v0.11.0
19
19
  with:
20
20
  url: https://journal123.com
21
21
  now: 2026-11-29T00:00:00Z
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,24 @@ 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
+
543
+ const webmcpForms = nodes
544
+ .filter((node) => node.tag === 'form')
545
+ .map((node) => ({
546
+ toolname: attribute(node, 'toolname'),
547
+ tooldescription: attribute(node, 'tooldescription'),
548
+ }));
549
+
533
550
  const times = [];
534
551
  for (const node of nodes) {
535
552
  if (node.tag !== 'time') continue;
@@ -651,6 +668,8 @@ export function analyzeHtml(html, pageUrl) {
651
668
  jsonLdTypes: [...new Set(jsonLd.flatMap((block) => block.types))].sort(),
652
669
  jsonLdValid: jsonLd.length > 0 && jsonLd.every((block) => block.ok),
653
670
  orgEntities,
671
+ jsonLdEntities,
672
+ webmcpForms,
654
673
  articleEntities,
655
674
  faqEntities,
656
675
  sameAs: [...new Set(sameAs)],
@@ -659,6 +678,7 @@ export function analyzeHtml(html, pageUrl) {
659
678
  metasAuthor: meta.author ?? null,
660
679
  bylines: [...new Set(bylines)],
661
680
  alternateLinks,
681
+ hreflangs: [...new Set(hreflangs)],
662
682
  relMe: [...new Set(relMe)],
663
683
  times,
664
684
  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,35 @@
12
12
  * - skip: excluded from the denominator (not applicable)
13
13
  */
14
14
 
15
- export const RUBRIC_VERSION = 'geo-rubric@1';
15
+ import { checkPageTypeSchema, checkSchemaCompleteness } from './schema.js';
16
+
17
+ export const RUBRIC_VERSION = 'geo-rubric@3';
18
+
19
+ /**
20
+ * The three optimisation pillars industry tools report separately.
21
+ *
22
+ * They are a second view over the same rules, never a second score: a rule
23
+ * contributes to exactly one pillar, and the pillars explain which part of the
24
+ * problem a finding belongs to. Adding a pillar does not change the Core total,
25
+ * which stays the five-dimension weighted score.
26
+ */
27
+ export const PILLARS = [
28
+ {
29
+ id: 'seo',
30
+ title: 'SEO',
31
+ summary: '传统搜索引擎:抓取、索引、元数据、规范 URL 与可发现性。',
32
+ },
33
+ {
34
+ id: 'aeo',
35
+ title: 'AEO',
36
+ summary: '答案引擎:语音助手与摘要场景需要的可回答结构、问答与实体。',
37
+ },
38
+ {
39
+ id: 'geo',
40
+ title: 'GEO',
41
+ summary: '生成式引擎:AI 爬虫策略、机器说明书、可引用性与时效。',
42
+ },
43
+ ];
16
44
 
17
45
  export const DIMENSIONS = [
18
46
  {
@@ -209,6 +237,7 @@ export const RULES = [
209
237
  // ---------------------------------------------------------------- 可发现性
210
238
  {
211
239
  id: 'disc.robots-present',
240
+ pillar: 'seo',
212
241
  dimension: 'discoverability',
213
242
  weight: 3,
214
243
  title: 'robots.txt 可访问',
@@ -221,6 +250,7 @@ export const RULES = [
221
250
  },
222
251
  {
223
252
  id: 'disc.robots-not-blocking-site',
253
+ pillar: 'seo',
224
254
  dimension: 'discoverability',
225
255
  weight: 4,
226
256
  title: 'robots.txt 未封禁站点',
@@ -238,6 +268,7 @@ export const RULES = [
238
268
  },
239
269
  {
240
270
  id: 'disc.ai-crawler-policy',
271
+ pillar: 'geo',
241
272
  dimension: 'discoverability',
242
273
  weight: 3,
243
274
  title: 'AI 爬虫策略明确',
@@ -256,6 +287,7 @@ export const RULES = [
256
287
  },
257
288
  {
258
289
  id: 'disc.googlebot-accessible',
290
+ pillar: 'seo',
259
291
  dimension: 'discoverability',
260
292
  weight: 3,
261
293
  title: 'Googlebot 可抓取',
@@ -271,6 +303,7 @@ export const RULES = [
271
303
  },
272
304
  {
273
305
  id: 'disc.sitemap-present',
306
+ pillar: 'seo',
274
307
  dimension: 'discoverability',
275
308
  weight: 3,
276
309
  title: 'XML sitemap 可用',
@@ -285,6 +318,7 @@ export const RULES = [
285
318
  },
286
319
  {
287
320
  id: 'disc.sitemap-declared',
321
+ pillar: 'seo',
288
322
  dimension: 'discoverability',
289
323
  weight: 2,
290
324
  title: 'sitemap 已声明',
@@ -301,6 +335,7 @@ export const RULES = [
301
335
  },
302
336
  {
303
337
  id: 'disc.sitemap-covers-pages',
338
+ pillar: 'seo',
304
339
  dimension: 'discoverability',
305
340
  weight: 2,
306
341
  title: 'sitemap 覆盖已抓取页面',
@@ -320,6 +355,7 @@ export const RULES = [
320
355
  },
321
356
  {
322
357
  id: 'disc.indexable',
358
+ pillar: 'seo',
323
359
  dimension: 'discoverability',
324
360
  weight: 3,
325
361
  title: '入口页可索引',
@@ -339,6 +375,7 @@ export const RULES = [
339
375
  },
340
376
  {
341
377
  id: 'disc.canonical',
378
+ pillar: 'seo',
342
379
  dimension: 'discoverability',
343
380
  weight: 2,
344
381
  title: 'canonical 自指且为绝对地址',
@@ -354,6 +391,7 @@ export const RULES = [
354
391
  },
355
392
  {
356
393
  id: 'disc.internal-links',
394
+ pillar: 'seo',
357
395
  dimension: 'discoverability',
358
396
  weight: 3,
359
397
  title: '入口页内链充分',
@@ -371,6 +409,7 @@ export const RULES = [
371
409
  // ---------------------------------------------------------------- 可解析性
372
410
  {
373
411
  id: 'parse.title',
412
+ pillar: 'seo',
374
413
  dimension: 'parsability',
375
414
  weight: 3,
376
415
  title: '<title> 长度合适',
@@ -385,6 +424,7 @@ export const RULES = [
385
424
  },
386
425
  {
387
426
  id: 'parse.meta-description',
427
+ pillar: 'seo',
388
428
  dimension: 'parsability',
389
429
  weight: 2,
390
430
  title: 'meta description 存在且合适',
@@ -400,6 +440,7 @@ export const RULES = [
400
440
  },
401
441
  {
402
442
  id: 'parse.lang',
443
+ pillar: 'seo',
403
444
  dimension: 'parsability',
404
445
  weight: 1,
405
446
  title: '<html lang> 已声明',
@@ -412,6 +453,7 @@ export const RULES = [
412
453
  },
413
454
  {
414
455
  id: 'parse.h1',
456
+ pillar: 'seo',
415
457
  dimension: 'parsability',
416
458
  weight: 2,
417
459
  title: '唯一且非空的主标题',
@@ -426,6 +468,7 @@ export const RULES = [
426
468
  },
427
469
  {
428
470
  id: 'parse.heading-order',
471
+ pillar: 'seo',
429
472
  dimension: 'parsability',
430
473
  weight: 2,
431
474
  title: '标题层级连续',
@@ -449,6 +492,7 @@ export const RULES = [
449
492
  },
450
493
  {
451
494
  id: 'parse.semantics',
495
+ pillar: 'aeo',
452
496
  dimension: 'parsability',
453
497
  weight: 2,
454
498
  title: '语义化正文容器',
@@ -462,6 +506,7 @@ export const RULES = [
462
506
  },
463
507
  {
464
508
  id: 'parse.raw-content',
509
+ pillar: 'aeo',
465
510
  dimension: 'parsability',
466
511
  weight: 3,
467
512
  title: '无 JS 也能读到正文',
@@ -476,6 +521,7 @@ export const RULES = [
476
521
  },
477
522
  {
478
523
  id: 'parse.pages-with-content',
524
+ pillar: 'aeo',
479
525
  dimension: 'parsability',
480
526
  weight: 2,
481
527
  title: '被抓取页面普遍含正文',
@@ -492,6 +538,7 @@ export const RULES = [
492
538
  },
493
539
  {
494
540
  id: 'parse.duplicate-metadata',
541
+ pillar: 'seo',
495
542
  dimension: 'parsability',
496
543
  weight: 2,
497
544
  title: '页面标题/描述不重复',
@@ -518,6 +565,7 @@ export const RULES = [
518
565
  },
519
566
  {
520
567
  id: 'parse.image-alt',
568
+ pillar: 'seo',
521
569
  dimension: 'parsability',
522
570
  weight: 2,
523
571
  title: '图片 alt 覆盖',
@@ -534,6 +582,7 @@ export const RULES = [
534
582
  },
535
583
  {
536
584
  id: 'parse.jsonld-syntax',
585
+ pillar: 'aeo',
537
586
  dimension: 'parsability',
538
587
  weight: 2,
539
588
  title: 'JSON-LD 语法有效',
@@ -549,6 +598,7 @@ export const RULES = [
549
598
  },
550
599
  {
551
600
  id: 'parse.link-text',
601
+ pillar: 'seo',
552
602
  dimension: 'parsability',
553
603
  weight: 1,
554
604
  title: '内链锚文本有描述性',
@@ -572,6 +622,7 @@ export const RULES = [
572
622
  // ---------------------------------------------------------------- 可引用性
573
623
  {
574
624
  id: 'cite.qa-structure',
625
+ pillar: 'aeo',
575
626
  dimension: 'citability',
576
627
  weight: 3,
577
628
  title: '问答结构',
@@ -588,6 +639,7 @@ export const RULES = [
588
639
  },
589
640
  {
590
641
  id: 'cite.summary',
642
+ pillar: 'aeo',
591
643
  dimension: 'citability',
592
644
  weight: 2,
593
645
  title: '摘要 / TL;DR 区块',
@@ -600,6 +652,7 @@ export const RULES = [
600
652
  },
601
653
  {
602
654
  id: 'cite.numeric-evidence',
655
+ pillar: 'geo',
603
656
  dimension: 'citability',
604
657
  weight: 3,
605
658
  title: '可验证的数字证据',
@@ -614,6 +667,7 @@ export const RULES = [
614
667
  },
615
668
  {
616
669
  id: 'cite.authority-sources',
670
+ pillar: 'geo',
617
671
  dimension: 'citability',
618
672
  weight: 2,
619
673
  title: '引用权威来源',
@@ -628,6 +682,7 @@ export const RULES = [
628
682
  },
629
683
  {
630
684
  id: 'cite.freshness',
685
+ pillar: 'geo',
631
686
  dimension: 'citability',
632
687
  weight: 3,
633
688
  title: '内容时效可判定',
@@ -646,6 +701,7 @@ export const RULES = [
646
701
  },
647
702
  {
648
703
  id: 'cite.author',
704
+ pillar: 'geo',
649
705
  dimension: 'citability',
650
706
  weight: 2,
651
707
  title: '作者署名可识别',
@@ -663,6 +719,7 @@ export const RULES = [
663
719
  },
664
720
  {
665
721
  id: 'cite.anchors',
722
+ pillar: 'aeo',
666
723
  dimension: 'citability',
667
724
  weight: 2,
668
725
  title: '章节可锚点引用',
@@ -681,6 +738,7 @@ export const RULES = [
681
738
  },
682
739
  {
683
740
  id: 'cite.structure',
741
+ pillar: 'aeo',
684
742
  dimension: 'citability',
685
743
  weight: 3,
686
744
  title: '结构化排版与短段落',
@@ -702,6 +760,7 @@ export const RULES = [
702
760
  },
703
761
  {
704
762
  id: 'cite.snippet-ready',
763
+ pillar: 'aeo',
705
764
  dimension: 'citability',
706
765
  weight: 3,
707
766
  title: '小节答案可直接摘录',
@@ -718,6 +777,7 @@ export const RULES = [
718
777
  // ---------------------------------------------------------------- 实体与信任
719
778
  {
720
779
  id: 'trust.https',
780
+ pillar: 'seo',
721
781
  dimension: 'trust',
722
782
  weight: 3,
723
783
  title: '全站 HTTPS',
@@ -735,6 +795,7 @@ export const RULES = [
735
795
  },
736
796
  {
737
797
  id: 'trust.org-schema',
798
+ pillar: 'aeo',
738
799
  dimension: 'trust',
739
800
  weight: 3,
740
801
  title: '组织实体 schema',
@@ -749,6 +810,7 @@ export const RULES = [
749
810
  },
750
811
  {
751
812
  id: 'trust.contact',
813
+ pillar: 'aeo',
752
814
  dimension: 'trust',
753
815
  weight: 2,
754
816
  title: '联系方式可找到',
@@ -766,6 +828,7 @@ export const RULES = [
766
828
  },
767
829
  {
768
830
  id: 'trust.about',
831
+ pillar: 'aeo',
769
832
  dimension: 'trust',
770
833
  weight: 2,
771
834
  title: 'About 页面可核实身份',
@@ -783,6 +846,7 @@ export const RULES = [
783
846
  },
784
847
  {
785
848
  id: 'trust.security-headers',
849
+ pillar: 'seo',
786
850
  dimension: 'trust',
787
851
  weight: 2,
788
852
  title: '基础安全响应头',
@@ -810,6 +874,7 @@ export const RULES = [
810
874
  },
811
875
  {
812
876
  id: 'trust.privacy',
877
+ pillar: 'aeo',
813
878
  dimension: 'trust',
814
879
  weight: 1,
815
880
  title: '隐私政策可达',
@@ -822,6 +887,7 @@ export const RULES = [
822
887
  },
823
888
  {
824
889
  id: 'trust.sameas',
890
+ pillar: 'geo',
825
891
  dimension: 'trust',
826
892
  weight: 2,
827
893
  title: '外部身份背书',
@@ -836,9 +902,218 @@ export const RULES = [
836
902
  },
837
903
  },
838
904
 
905
+ {
906
+ id: 'seo.viewport',
907
+ pillar: 'seo',
908
+ dimension: 'parsability',
909
+ weight: 2,
910
+ title: '移动端视口声明',
911
+ fix: '在 <head> 输出 <meta name="viewport" content="width=device-width, initial-scale=1">;缺少它会让移动端按桌面宽度渲染。',
912
+ evaluate({ primary }) {
913
+ if (!primary) return fail('未抓取到 HTML 入口页');
914
+ const viewport = primary.facts.metaViewport ?? '';
915
+ if (!viewport) return fail('缺少 meta viewport');
916
+ if (/width\s*=\s*device-width/i.test(viewport)) return pass(viewport.slice(0, 80));
917
+ return warn(`viewport 未使用 device-width:${viewport.slice(0, 80)}`);
918
+ },
919
+ },
920
+ {
921
+ id: 'seo.image-dimensions',
922
+ pillar: 'seo',
923
+ dimension: 'parsability',
924
+ weight: 2,
925
+ title: '图片声明宽高',
926
+ fix: '为 <img> 写上 width/height 或使用 aspect-ratio,避免加载时布局跳动(CLS)。',
927
+ evaluate({ factsPages }) {
928
+ const stats = imageStats(factsPages);
929
+ if (stats.total === 0) return skip('未使用图片');
930
+ let withDimensions = 0;
931
+ for (const page of factsPages) {
932
+ for (const image of page.facts.images) if (image.hasDimensions) withDimensions += 1;
933
+ }
934
+ const ratio = withDimensions / stats.total;
935
+ const evidence = `${withDimensions}/${stats.total} 张图片声明了宽高`;
936
+ if (ratio >= 0.8) return pass(evidence);
937
+ if (ratio >= 0.4) return warn(evidence);
938
+ return fail(evidence);
939
+ },
940
+ },
941
+ {
942
+ id: 'seo.image-lazy',
943
+ pillar: 'seo',
944
+ dimension: 'parsability',
945
+ weight: 1,
946
+ title: '首屏外图片懒加载',
947
+ fix: '给首屏以下的图片加 loading="lazy",首屏图不要加,避免延迟最大内容渲染。',
948
+ evaluate({ primary }) {
949
+ if (!primary) return fail('未抓取到 HTML 入口页');
950
+ const images = primary.facts.images ?? [];
951
+ if (images.length === 0) return skip('入口页没有图片');
952
+ const lazy = images.filter((image) => image.lazy).length;
953
+ if (lazy > 0) return pass(`${lazy}/${images.length} 张图片使用 loading="lazy"`);
954
+ if (images.length <= 2) return skip(`入口页只有 ${images.length} 张图片,懒加载意义有限`);
955
+ return warn(`${images.length} 张图片都没有 loading="lazy"`);
956
+ },
957
+ },
958
+ {
959
+ id: 'seo.url-structure',
960
+ pillar: 'seo',
961
+ dimension: 'discoverability',
962
+ weight: 2,
963
+ title: 'URL 结构可读',
964
+ fix: '用短、含语义词的路径;避免大写、下划线、过长 query 串与深层嵌套(超过 4 层)。',
965
+ evaluate({ pages }) {
966
+ const html = pages.filter((page) => page.facts);
967
+ if (html.length === 0) return fail('未抓取到 HTML 页面');
968
+ const problems = [];
969
+ for (const page of html) {
970
+ const path = page.path ?? '/';
971
+ const depth = path.split('/').filter(Boolean).length;
972
+ if (depth > 4) problems.push(`${path}(${depth} 层)`);
973
+ else if (/[A-Z]/.test(path)) problems.push(`${path}(含大写)`);
974
+ else if (/_/.test(path)) problems.push(`${path}(含下划线)`);
975
+ else if ((page.facts.url ?? '').length > 120) problems.push(`${path}(过长)`);
976
+ }
977
+ if (problems.length === 0) return pass(`${html.length} 个页面路径结构清晰`);
978
+ if (problems.length <= Math.ceil(html.length / 2)) return warn(`${problems.length} 个页面路径可优化:${problems.slice(0, 3).join('、')}`);
979
+ return fail(`${problems.length}/${html.length} 个页面路径可优化`);
980
+ },
981
+ },
982
+ {
983
+ id: 'seo.hreflang',
984
+ pillar: 'seo',
985
+ dimension: 'discoverability',
986
+ weight: 1,
987
+ title: '多语言 hreflang',
988
+ fix: '若站点有多个语言版本,用 <link rel="alternate" hreflang="..."> 标注互指;单语言站点可忽略。',
989
+ evaluate({ primary }) {
990
+ if (!primary) return fail('未抓取到 HTML 入口页');
991
+ if (primary.facts.hreflangs.length > 0) {
992
+ return pass(`${primary.facts.hreflangs.length} 个 hreflang:${primary.facts.hreflangs.slice(0, 5).join(', ')}`);
993
+ }
994
+ return skip('未声明 hreflang;单语言站点不需要');
995
+ },
996
+ },
997
+ {
998
+ id: 'aeo.answer-first',
999
+ pillar: 'aeo',
1000
+ dimension: 'citability',
1001
+ weight: 3,
1002
+ title: '正文开头给出直接答案',
1003
+ fix: '在第一个 h1 之后紧跟一段 2–4 句的直接回答,再展开解释;语音助手与摘要更依赖开头的自足段落。',
1004
+ evaluate({ primary }) {
1005
+ if (!primary) return fail('未抓取到 HTML 入口页');
1006
+ const sections = primary.facts.sections ?? [];
1007
+ // Bylines and kickers are short paragraphs before the real answer; skip
1008
+ // them and judge the first substantial paragraph near the top instead.
1009
+ const candidates = sections
1010
+ .slice(0, 3)
1011
+ .flatMap((section) => section.paragraphs)
1012
+ .filter((text) => text.length > 0);
1013
+ const first = candidates.find((text) => text.length >= 25);
1014
+ if (!first) {
1015
+ const longest = candidates.sort((a, b) => b.length - a.length)[0] ?? '';
1016
+ return fail(`开头没有可作答案的段落(最长 ${longest.length} 字)`);
1017
+ }
1018
+ if (first.length >= 60) return pass(`开头段落 ${first.length} 字:${first.slice(0, 60)}…`);
1019
+ return warn(`开头段落仅 ${first.length} 字,建议扩成 2–4 句直接回答`);
1020
+ },
1021
+ },
1022
+ {
1023
+ id: 'aeo.question-density',
1024
+ pillar: 'aeo',
1025
+ dimension: 'citability',
1026
+ weight: 2,
1027
+ title: '问句式标题覆盖',
1028
+ fix: '用用户真实的提问作为 h2/h3(“怎么…”“为什么…”“是否…”),一段回答一个问题。',
1029
+ evaluate({ primary }) {
1030
+ if (!primary) return fail('未抓取到 HTML 入口页');
1031
+ const headings = primary.facts.headings.filter((heading) => heading.level >= 2);
1032
+ if (headings.length === 0) return fail('入口页没有二级标题');
1033
+ const questions = primary.facts.questionHeadings.length;
1034
+ const ratio = questions / headings.length;
1035
+ const evidence = `${questions}/${headings.length} 个二级标题是问句`;
1036
+ if (questions >= 3 && ratio >= 0.25) return pass(evidence);
1037
+ if (questions >= 1) return warn(evidence);
1038
+ return fail(evidence);
1039
+ },
1040
+ },
1041
+ {
1042
+ id: 'aeo.definition-list',
1043
+ pillar: 'aeo',
1044
+ dimension: 'citability',
1045
+ weight: 1,
1046
+ title: '术语与要点可抽取',
1047
+ fix: '用 <dl>/<table>/<ul> 承载定义、对比与步骤;纯段落堆叠不易被答案引擎抽成条目。',
1048
+ evaluate({ primary }) {
1049
+ if (!primary) return fail('未抓取到 HTML 入口页');
1050
+ const { tables, lists, definitionLists } = primary.facts.counts;
1051
+ const total = tables + lists + definitionLists;
1052
+ if (total >= 3) return pass(`${tables} 表格 / ${lists} 列表 / ${definitionLists} 定义列表`);
1053
+ if (total >= 1) return warn(`仅 ${total} 处结构化列表或表格`);
1054
+ return fail('没有列表、表格或定义列表');
1055
+ },
1056
+ },
1057
+
1058
+ {
1059
+ id: 'seo.schema-fields',
1060
+ pillar: 'seo',
1061
+ dimension: 'parsability',
1062
+ weight: 3,
1063
+ title: '结构化数据字段完整',
1064
+ fix: '按 schema.org 定义补齐必备属性:Article 要 headline/author/datePublished,Product 要 name 与 offers,Organization 要 name 与 url。',
1065
+ evaluate({ factsPages }) {
1066
+ const result = checkSchemaCompleteness(factsPages);
1067
+ if (result.summary.total === 0) return skip('页面没有带 @type 的结构化数据');
1068
+ const broken = result.entities.filter((entity) => entity.missingRequired.length > 0);
1069
+ if (broken.length === 0) {
1070
+ return pass(`${result.summary.total} 个实体必备字段齐全`);
1071
+ }
1072
+ const examples = broken.slice(0, 3).map((entity) => `${entity.type} 缺 ${entity.missingRequired.join('/')}`);
1073
+ const evidence = `${broken.length}/${result.summary.total} 个实体缺必备字段:${examples.join(';')}`;
1074
+ return broken.length === result.summary.total ? fail(evidence) : warn(evidence);
1075
+ },
1076
+ },
1077
+ {
1078
+ id: 'seo.schema-matches-page-type',
1079
+ pillar: 'seo',
1080
+ dimension: 'parsability',
1081
+ weight: 2,
1082
+ title: '页面类型与结构化数据匹配',
1083
+ fix: '内容页输出 Article/BlogPosting,商品页输出 Product,问答页输出 FAQPage;类型与内容不符会被忽略。',
1084
+ evaluate({ scan, factsPages }) {
1085
+ const signals = checkPageTypeSchema(scan, factsPages);
1086
+ if (signals.length === 0) return skip('未能从 URL 或内容推断页面类型');
1087
+ const missing = signals.filter((signal) => !signal.present);
1088
+ if (missing.length === 0) {
1089
+ return pass(signals.map((signal) => `${signal.pageType}✓`).join(' '));
1090
+ }
1091
+ // Inference, not proof: report as partial rather than a hard failure.
1092
+ return warn(`疑似 ${missing.map((signal) => signal.pageType).join('/')} 页缺少对应类型(${missing.map((signal) => signal.expected.join(' 或 ')).join(';')})`);
1093
+ },
1094
+ },
1095
+ {
1096
+ id: 'geo.agent-tools',
1097
+ pillar: 'geo',
1098
+ dimension: 'manifest',
1099
+ weight: 2,
1100
+ title: '可选:WebMCP agent 工具声明',
1101
+ fix: '可选能力:若希望 agent 直接调用站内功能,给 <form> 加 toolname/tooldescription(W3C WebMCP 草案);普通内容站不需要。',
1102
+ evaluate({ factsPages }) {
1103
+ const forms = factsPages.flatMap((page) => page.facts.webmcpForms ?? []);
1104
+ if (forms.length === 0) return skip('页面没有表单,也没有 WebMCP 声明;这是可选能力');
1105
+ const named = forms.filter((form) => form.toolname && form.tooldescription);
1106
+ if (named.length > 0 && named.length === forms.length) return pass(`${named.length} 个表单已声明 WebMCP 工具`);
1107
+ if (named.length > 0) return warn(`${forms.length} 个表单中 ${forms.length - named.length} 个缺少 toolname 或 tooldescription`);
1108
+ // Plain search/filter forms are not agent tools; absence is not a defect.
1109
+ return skip(`${forms.length} 个普通表单未声明 WebMCP;这是可选能力,内容站不需要`);
1110
+ },
1111
+ },
1112
+
839
1113
  // ---------------------------------------------------------------- 机器说明书
840
1114
  {
841
1115
  id: 'manifest.llms-txt',
1116
+ pillar: 'geo',
842
1117
  dimension: 'manifest',
843
1118
  weight: 2,
844
1119
  title: 'llms.txt(可选,非 Google 必需)',
@@ -852,6 +1127,7 @@ export const RULES = [
852
1127
  },
853
1128
  {
854
1129
  id: 'manifest.llms-structure',
1130
+ pillar: 'geo',
855
1131
  dimension: 'manifest',
856
1132
  weight: 1,
857
1133
  title: 'llms.txt 结构完整(可选)',
@@ -866,6 +1142,7 @@ export const RULES = [
866
1142
  },
867
1143
  {
868
1144
  id: 'manifest.structured-breadth',
1145
+ pillar: 'geo',
869
1146
  dimension: 'manifest',
870
1147
  weight: 2,
871
1148
  title: 'schema.org 类型覆盖面(富结果)',
@@ -880,6 +1157,7 @@ export const RULES = [
880
1157
  },
881
1158
  {
882
1159
  id: 'manifest.og-cards',
1160
+ pillar: 'seo',
883
1161
  dimension: 'manifest',
884
1162
  weight: 1,
885
1163
  title: 'OpenGraph / 分享卡片',
@@ -895,6 +1173,7 @@ export const RULES = [
895
1173
  },
896
1174
  {
897
1175
  id: 'manifest.feed',
1176
+ pillar: 'seo',
898
1177
  dimension: 'manifest',
899
1178
  weight: 1,
900
1179
  title: '内容 feed(可选)',
@@ -909,6 +1188,7 @@ export const RULES = [
909
1188
  },
910
1189
  {
911
1190
  id: 'manifest.link-hints',
1191
+ pillar: 'geo',
912
1192
  dimension: 'manifest',
913
1193
  weight: 1,
914
1194
  title: 'HTTP Link / Markdown 入口提示(可选)',
@@ -924,6 +1204,7 @@ export const RULES = [
924
1204
  },
925
1205
  {
926
1206
  id: 'manifest.entity-id',
1207
+ pillar: 'geo',
927
1208
  dimension: 'manifest',
928
1209
  weight: 1,
929
1210
  title: '实体 @id 稳定',
package/lib/schema.js ADDED
@@ -0,0 +1,141 @@
1
+ /**
2
+ * Schema.org completeness: does a declared type carry the properties a
3
+ * consumer actually needs?
4
+ *
5
+ * Two different standards apply, and conflating them is a common mistake:
6
+ *
7
+ * - **Required for Google rich results.** Google's structured-data
8
+ * documentation lists required and recommended properties per feature, and
9
+ * only those produce rich results. A type Google does not consume at all
10
+ * (or no longer consumes) earns nothing regardless of completeness.
11
+ * - **Required for the type to be meaningful.** schema.org itself defines few
12
+ * hard requirements, but a `Product` without an offer, or an `Article`
13
+ * without a headline, does not describe what it claims to describe.
14
+ *
15
+ * This module only encodes the second kind plus the fields Google publishes as
16
+ * required, and it labels which is which. It never claims a rich-result outcome.
17
+ *
18
+ * Source: https://schema.org/docs/full.html and the per-feature pages under
19
+ * https://developers.google.com/search/docs/appearance/structured-data
20
+ */
21
+ export const SCHEMA_REQUIREMENTS = {
22
+ Article: { required: ['headline', 'author', 'datePublished'], recommended: ['dateModified', 'image', 'publisher'] },
23
+ NewsArticle: { required: ['headline', 'author', 'datePublished'], recommended: ['dateModified', 'image', 'publisher'] },
24
+ BlogPosting: { required: ['headline', 'author', 'datePublished'], recommended: ['dateModified', 'image'] },
25
+ TechArticle: { required: ['headline', 'author', 'datePublished'], recommended: ['dateModified', 'image'] },
26
+ Product: { required: ['name'], recommended: ['offers', 'image', 'brand', 'sku', 'aggregateRating'] },
27
+ Offer: { required: ['price', 'priceCurrency'], recommended: ['availability', 'url', 'priceValidUntil'] },
28
+ Organization: { required: ['name'], recommended: ['url', 'logo', 'sameAs', 'contactPoint'] },
29
+ Person: { required: ['name'], recommended: ['url', 'sameAs', 'jobTitle'] },
30
+ WebSite: { required: ['name', 'url'], recommended: ['potentialAction', 'description'] },
31
+ WebPage: { required: ['name'], recommended: ['url', 'description', 'dateModified'] },
32
+ BreadcrumbList: { required: ['itemListElement'], recommended: [] },
33
+ FAQPage: { required: ['mainEntity'], recommended: [] },
34
+ Question: { required: ['name', 'acceptedAnswer'], recommended: [] },
35
+ HowTo: { required: ['name', 'step'], recommended: ['image', 'totalTime'] },
36
+ Event: { required: ['name', 'startDate', 'location'], recommended: ['endDate', 'image', 'offers'] },
37
+ Recipe: { required: ['name', 'recipeIngredient', 'recipeInstructions'], recommended: ['image', 'author'] },
38
+ VideoObject: { required: ['name', 'thumbnailUrl', 'uploadDate'], recommended: ['description', 'duration', 'contentUrl'] },
39
+ LocalBusiness: { required: ['name', 'address'], recommended: ['telephone', 'openingHours', 'priceRange'] },
40
+ ItemList: { required: ['itemListElement'], recommended: ['name'] },
41
+ Course: { required: ['name', 'description'], recommended: ['provider'] },
42
+ JobPosting: { required: ['title', 'description', 'datePosted', 'hiringOrganization'], recommended: ['jobLocation', 'baseSalary'] },
43
+ };
44
+
45
+ /** Types Google states it consumes for rich results, with the caveat that most
46
+ * require per-feature checks this audit does not perform. */
47
+ export const GOOGLE_RICH_RESULT_TYPES = new Set([
48
+ 'Article', 'NewsArticle', 'BlogPosting', 'Product', 'Offer', 'BreadcrumbList',
49
+ 'Event', 'Recipe', 'VideoObject', 'LocalBusiness', 'JobPosting', 'Course',
50
+ 'FAQPage', 'HowTo', 'Question', 'ItemList', 'Person', 'Organization', 'WebSite',
51
+ ]);
52
+
53
+ function hasProperty(entity, property) {
54
+ const value = entity[property];
55
+ if (value === undefined || value === null) return false;
56
+ if (typeof value === 'string') return value.trim().length > 0;
57
+ if (Array.isArray(value)) return value.length > 0;
58
+ if (typeof value === 'object') return Object.keys(value).length > 0;
59
+ return true;
60
+ }
61
+
62
+ function typesOf(entity) {
63
+ const type = entity?.['@type'];
64
+ if (typeof type === 'string') return [type];
65
+ if (Array.isArray(type)) return type.filter((entry) => typeof entry === 'string');
66
+ return [];
67
+ }
68
+
69
+ /**
70
+ * Check every typed entity on the crawled pages against its requirements.
71
+ *
72
+ * @param {object[]} factsPages - Pages carrying facts.
73
+ * @returns {{entities: Array<object>, summary: object, unknownTypes: string[]}}
74
+ */
75
+ export function checkSchemaCompleteness(factsPages) {
76
+ const entities = [];
77
+ const unknownTypes = new Set();
78
+
79
+ for (const page of factsPages) {
80
+ for (const entity of page.facts.jsonLdEntities ?? []) {
81
+ for (const type of typesOf(entity)) {
82
+ const rule = SCHEMA_REQUIREMENTS[type];
83
+ if (!rule) {
84
+ unknownTypes.add(type);
85
+ continue;
86
+ }
87
+ const missingRequired = rule.required.filter((property) => !hasProperty(entity, property));
88
+ const missingRecommended = rule.recommended.filter((property) => !hasProperty(entity, property));
89
+ entities.push({
90
+ page: page.path,
91
+ type,
92
+ missingRequired,
93
+ missingRecommended,
94
+ googleRichResultType: GOOGLE_RICH_RESULT_TYPES.has(type),
95
+ });
96
+ }
97
+ }
98
+ }
99
+
100
+ const complete = entities.filter((entity) => entity.missingRequired.length === 0);
101
+ return {
102
+ entities,
103
+ summary: {
104
+ total: entities.length,
105
+ complete: complete.length,
106
+ incomplete: entities.length - complete.length,
107
+ },
108
+ unknownTypes: [...unknownTypes].sort(),
109
+ };
110
+ }
111
+
112
+ /**
113
+ * Whether the site is a page type that expects a matching schema type.
114
+ *
115
+ * This is inference from observable signals, and the caller must present it as
116
+ * such: a site can be a product page without looking like one.
117
+ *
118
+ * @param {object} scan
119
+ * @param {object[]} factsPages
120
+ */
121
+ export function checkPageTypeSchema(scan, factsPages) {
122
+ const present = new Set(factsPages.flatMap((page) => page.facts.jsonLdTypes ?? []));
123
+ const path = scan.startUrl ? new URL(scan.startUrl).pathname : '/';
124
+ const primary = factsPages.find((page) => page.depth === 0) ?? factsPages[0];
125
+ const text = primary?.facts?.text ?? '';
126
+ const signals = [];
127
+
128
+ if (/(?:^|\/)(?:product|products|item|shop|p)\//i.test(path) || /\b(?:add to cart|buy now|price)\b/i.test(text)) {
129
+ signals.push({ pageType: 'product', expected: ['Product'], present: present.has('Product') });
130
+ }
131
+ if (/(?:^|\/)(?:blog|article|news|post|posts)\//i.test(path) || (primary?.facts?.articleEntities?.length ?? 0) > 0) {
132
+ signals.push({ pageType: 'article', expected: ['Article', 'NewsArticle', 'BlogPosting'], present: ['Article', 'NewsArticle', 'BlogPosting'].some((type) => present.has(type)) });
133
+ }
134
+ if ((primary?.facts?.faqEntities?.length ?? 0) > 0 || (primary?.facts?.questionHeadings?.length ?? 0) >= 3) {
135
+ signals.push({ pageType: 'faq', expected: ['FAQPage'], present: present.has('FAQPage') });
136
+ }
137
+ if (/\b(?:opening hours|visit us|our address|directions)\b/i.test(text)) {
138
+ signals.push({ pageType: 'local-business', expected: ['LocalBusiness'], present: present.has('LocalBusiness') });
139
+ }
140
+ return signals;
141
+ }
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.9.0",
3
+ "version": "0.11.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": {