跳到正文
Skillpedia
SEO75k · #2906

json-ld-valid

它能做什么

这个技能检查页面上的结构化数据代码块是否有语法错误或缺少必填字段。它面向希望获得富媒体搜索结果的网站所有者和开发者。

适用场景

  • ✓你的富媒体结果没有出现在 Google Search Console 中的时候。
  • ✓你在页面中添加文章、产品、常见问题或面包屑标记的时候。
  • ✓你用代码或模板生成结构化数据的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/json-ld-valid/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/json-ld-valid/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我检查结构化数据,并告诉我富媒体结果为什么没有显示吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会解析每个 JSON-LD 代码块,检查上下文和类型,并验证该类型所需的属性。它会建议修复语法错误和缺失字段,并推荐 Google 的富媒体结果测试工具。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Use valid JSON-LD structured data

Invalid JSON-LD is silently ignored by Google — there are no error messages in search results, only the absence of rich results. Invalid structured data means no eligibility for rich results (stars, FAQs, breadcrumbs, etc.) that increase click-through rates.

Quick Reference

  • JSON-LD must be valid JSON, reference @context: 'https://schema.org', and include all required properties for the chosen @type
  • Invalid JSON (unclosed brackets, missing commas) causes the entire block to be silently ignored by Google
  • Validate with Google's Rich Results Test before deploying structured data changes

Check

Find all <script type='application/ld+json'> elements on the page. For each: (1) Attempt to parse the content as JSON — flag syntax errors. (2) Verify @context is set to 'https://schema.org'. (3) Verify @type is a valid schema.org type. (4) For the detected type, check required properties are present (e.g., Article requires headline, author, datePublished; Product requires name; FAQPage requires mainEntity). (5) Run through Google's Rich Results Test API if available.

Fix

  1. Parse the JSON-LD with JSON.parse() — fix any syntax errors (trailing commas, single quotes, missing brackets).
  2. Ensure @context is exactly "https://schema.org" (not "http://schema.org" or omitted).
  3. Verify the @type value against schema.org types.
  4. Add required properties for the type:
    • Article: headline, author (with @type Person and name), datePublished
    • Product: name (and ideally offers, description)
    • FAQPage: mainEntity array with Question and acceptedAnswer
    • BreadcrumbList: itemListElement array with ListItem, position, name, item
  5. Validate at https://search.google.com/test/rich-results
  6. Validate JSON syntax at https://jsonlint.com

Explain

Google uses JSON-LD structured data to generate rich results — enhanced search result formats that include stars, images, expandable Q&As, and other features. Invalid JSON-LD is ignored entirely: no rich results are generated, and no error is reported to you. Only by testing with the Rich Results Test can you discover validation failures. Correct, complete JSON-LD is a prerequisite for rich result eligibility.

Code Review

Extract all <script type='application/ld+json'> element contents. Run JSON.parse() on each — catch and report parse errors. Validate that @context equals 'https://schema.org'. Check @type against a whitelist of common valid types. For each type, validate required properties are present and non-empty. Report the first validation error found for each block.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/seo/json-ld-valid

常见问题

Google 会对无效的结构化数据显示错误吗?

这个技能说,无效的 JSON-LD 会被无声忽略,唯一的迹象就是富媒体结果不出现。

常见的语法问题有哪些?

这个技能提到,多余的逗号、单引号和缺少的括号是常见原因。

如何测试标记?

这个技能建议在发布更改之前,先用 Google 的富媒体结果测试工具检查。

详情

作者的原始描述

Use when generating or auditing any `<script type='application/ld+json'>` blocks, implementing structured data for articles, products, FAQs, breadcrumbs, or local businesses, or investigating why rich results are not appearing in Google Search Console.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2906
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能