Chuyển đến nội dung
Skillpedia
SEO75k · #2906

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.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/json-ld-valid/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

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

  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

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.

repo: thedaviddias/Front-End-Checklist

Độ 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

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự