把 URL 粘进 Google Rich Results Test,页面满屏黄色警告:“Missing field ‘image’”、“Missing field ‘datePublished’”、“The value ‘string’ is not a valid date.”。Search Console Enhancement 报告显示一样的内容。富 snippet——星级、FAQ 折叠、面包屑——在 SERP 不出现。修法很直接:JSON-LD 必须严格匹配 schema.org。以 Rich Results Test 为准。每个警告都有明确的修正动作。
本文过一遍最常见的几类警告以及实际意义。
常见原因
按命中率从高到低。
1. 缺必需字段
每个 schema 类型有必需字段。Article 需要 headline、image、datePublished、author。任一缺失 Rich Results Test 就报 “Missing field”。
怎么判断:Rich Results Test → 展开 JSON-LD 块 → 找红色 “Missing field” 行。
最常缺的:
| Schema | 经常缺的必需字段 |
|---|---|
| Article | image、author.name、datePublished |
| FAQPage | mainEntity[].acceptedAnswer.text |
| BreadcrumbList | itemListElement[].position、item.@id |
| Product | image、offers.price、offers.priceCurrency |
| Recipe | image、recipeIngredient、recipeInstructions |
2. 数据类型错
字段要 date 你给 string。要 URL 你给路径。要 Person 对象你给名字字符串。
例子:
"datePublished": "May 2026" // 错:不是 ISO 8601
"datePublished": "2026-05-17" // 对
"author": "Liziang Zheng" // 错:裸字符串
"author": { "@type": "Person", "name": "Liziang Zheng" } // 对
3. schema 类型用错
教程标成 Product(想出星级)、链接列表标成 FAQPage。Google 检测到会降权。
怎么判断:读 Google schema 参考对应你内容类型的部分。@type 跟实际内容对不上就改。
4. 多个 JSON-LD 块冲突
页面有两个 <script type="application/ld+json">——一个说 Article、一个说 BlogPosting,或者两个声明了不同的 @id。Google 读所有块,不一致就报警告。
怎么判断:
curl -s "https://yoursite.com/article" | grep -c '<script type="application/ld+json">'
1 = 多块。合到一个里(多类型用
@graph)。
5. URL 字段是相对路径
"image": "/og-cover.png"——Google 需要绝对 URL。应该 "https://yoursite.com/og-cover.png"。
6. 字段超长
某些字段有隐式限制:description 应 < 5000 字符、headline < 110、name < 75。超了报警告。
7. JSON 语法错
尾逗号、未转义引号、括号类型错。Rich Results Test 报 “Cannot parse content as JSON”。
怎么判断:把 JSON-LD 块粘进 jsonlint.com 之类的 JSON 校验器。
最短修复路径
第 1 步:测受影响的 URL
打开 Rich Results Test → 输 URL → 展开警告。
每条警告记:
- 哪个 JSON-LD 块(行号范围)
- 哪个字段
- 期望类型 vs. 实际值
第 2 步:建一份正确基线
不要手写 JSON-LD。用生成器。
Article 页面:
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "文章标题",
"image": ["https://yoursite.com/og-cover.png"],
"datePublished": "2026-05-17T00:00:00Z",
"dateModified": "2026-05-22T00:00:00Z",
"author": {
"@type": "Person",
"name": "作者名",
"url": "https://yoursite.com/about"
},
"publisher": {
"@type": "Organization",
"name": "站点名",
"logo": {
"@type": "ImageObject",
"url": "https://yoursite.com/logo.png"
}
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://yoursite.com/article"
}
}
第 3 步:多类型用 @graph
确实要在同一页放 Article + FAQPage:
{
"@context": "https://schema.org",
"@graph": [
{ "@type": "Article", "@id": "https://yoursite.com/article#article", "..." },
{ "@type": "FAQPage", "@id": "https://yoursite.com/article#faq", "..." }
]
}
一个 <script> 块,两种类型,不冲突。
第 4 步:在模板层修
不要逐篇修。找 layout 的 JSON-LD 生成器,一次修复。Astro:
---
const { article } = Astro.props;
const jsonLd = {
"@context": "https://schema.org",
"@type": "Article",
headline: article.title,
image: [new URL(article.image, Astro.site).toString()],
datePublished: new Date(article.publishedAt).toISOString(),
// ...
};
---
<script type="application/ld+json" set:html={JSON.stringify(jsonLd)}></script>
第 5 步:CI 校验
// scripts/check-json-ld.mjs
import fs from 'node:fs';
import path from 'node:path';
const required = {
Article: ['headline', 'image', 'datePublished', 'author'],
FAQPage: ['mainEntity'],
// ...
};
function walk(dir) {
for (const f of fs.readdirSync(dir)) {
const p = path.join(dir, f);
if (fs.statSync(p).isDirectory()) walk(p);
else if (p.endsWith('.html')) {
const html = fs.readFileSync(p, 'utf8');
const matches = html.match(/<script type="application\/ld\+json">([\s\S]+?)<\/script>/g) || [];
for (const m of matches) {
const json = JSON.parse(m.replace(/<\/?script[^>]*>/g, ''));
const type = json['@type'];
for (const field of (required[type] || [])) {
if (!json[field]) console.error(`MISSING ${field} in ${type} at ${p}`);
}
}
}
}
}
walk('dist');
第 6 步:重测并提交
部署后:
- 重跑 Rich Results Test → 全绿。
- Search Console → URL Inspection → Request indexing。
- 等 7-14 天 Search Console Enhancement 报告更新。
预防建议
- 用模板生成器吐 JSON-LD,永远别手写。
- 每页一个
<script type="application/ld+json">块(多类型用@graph)。 - 日期用 ISO 8601:
2026-05-17T00:00:00Z。永远不要 “May 2026” 或 “5/17/2026”。 - JSON-LD 里只用绝对 URL。
- 部署后在 CI 跑 Rich Results Test API 抽查样本 URL。
相关阅读
标签: #排查 #SEO #排查 #结构化数据 #Rich Results