json-ld-valid
Skill này làm gì
Skill này kiểm tra các khối dữ liệu có cấu trúc trên trang xem có lỗi cú pháp hoặc thiếu trường bắt buộc không. Skill dành cho chủ website và lập trình viên muốn có kết quả tìm kiếm phong phú.
Khi nào nên dùng
- ✓Khi kết quả phong phú không xuất hiện trong Google Search Console.
- ✓Khi bạn thêm markup bài viết, sản phẩm, FAQ hoặc breadcrumb vào trang.
- ✓Khi bạn tạo dữ liệu có cấu trúc bằng mã hoặc template.
Liên kết skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/json-ld-valid/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể kiểm tra dữ liệu có cấu trúc của tôi và cho biết vì sao kết quả phong phú chưa hiển thị không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent phân tích từng khối JSON-LD, kiểm tra context và type, rồi xác minh các thuộc tính bắt buộc của loại đó. Agent gợi ý sửa lỗi cú pháp và các trường bị thiếu, đồng thời khuyên dùng Rich Results Test của Google.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
- Parse the JSON-LD with
JSON.parse()— fix any syntax errors (trailing commas, single quotes, missing brackets). - Ensure
@contextis exactly"https://schema.org"(not"http://schema.org"or omitted). - Verify the
@typevalue against schema.org types. - 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
- Validate at https://search.google.com/test/rich-results
- 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
Câu hỏi thường gặp
Google có báo lỗi khi dữ liệu có cấu trúc không hợp lệ không?
Skill nói JSON-LD không hợp lệ sẽ bị bỏ qua âm thầm, nên dấu hiệu duy nhất là thiếu kết quả phong phú.
Lỗi cú pháp thường gặp là gì?
Skill nêu dấu phẩy thừa cuối cùng, dấu nháy đơn và thiếu ngoặc là các nguyên nhân phổ biến.
Làm sao kiểm tra markup?
Skill khuyên dùng Rich Results Test của Google trước khi công bố thay đổi.
Chi tiết
Mô tả gốc của tác giả
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.
Độ phổ biến
- Sao GitHub
- 75k
- Vị trí xếp hạng
- #2906
- Giấy phép
- MIT
- Cập nhật
- 31/10/2026
Bình luận
- …
Thêm skill từ kho mã này
frontendchecklist
75kKiểm tra mã frontend và trang trực tiếp theo hơn 380 quy tắc về khả năng tiếp cận, tốc độ, SEO và bảo mật, bằng một công cụ dòng lệnh.
frontend-checklist-global
75kKiểm toán một dự án frontend theo đủ 386 quy tắc của Front-End Checklist, và đưa cách sửa cụ thể cho từng vấn đề tìm thấy.
404-page
75kKiểm tra xem trang báo thiếu của bạn có đưa ra các liên kết hữu ích và trả về mã trạng thái 404 thật hay không, để giúp khách bị lạc tìm đường.
about-page
75kKiểm tra xem trang web có trang Giới thiệu rõ ràng giải thích ai điều hành nó hay không, để xây dựng niềm tin với khách và công cụ tìm kiếm.
Skill tương tự
competitive-platform-analysis
280kGiúp bạn hiểu rõ đối thủ cạnh tranh. Công cụ xác định, phân loại và lọc các công ty cạnh tranh trước khi phân tích sâu hơn.
competitive-report-structure
280kTạo báo cáo đối thủ cạnh tranh toàn diện. Kết hợp thông tin để thể hiện bức tranh chung, đề xuất và giúp đồng đội thống nhất hướng đi.
lead-intelligence
280kGiúp agent tìm và liên hệ với những người quan trọng. Phân tích khách hàng tiềm năng, gợi ý cách tiếp cận và quản lý việc liên lạc qua email và mạng xã hội.