algo-seo-schema

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Schema.org Structured Data

Schema.org 结构化数据

Overview

概述

Schema.org structured data provides machine-readable page context to search engines via JSON-LD. Enables rich results (stars, FAQs, breadcrumbs, product cards) in SERPs. Implementation is O(1) per page — it's a markup task, not computational.
Schema.org结构化数据通过JSON-LD为搜索引擎提供机器可读取的页面上下文,能够在搜索引擎结果页(SERPs)中展示富媒体结果(如星级评分、FAQ、面包屑导航、产品卡片)。每个页面的实现复杂度为O(1)——这是一项标记任务,而非计算任务。

When to Use

使用场景

Trigger conditions:
  • Adding rich snippet eligibility to web pages
  • Implementing product, article, FAQ, HowTo, or event markup
  • Debugging Google Search Console structured data errors
When NOT to use:
  • When optimizing page content or keywords (use content SEO)
  • When improving page speed (use Core Web Vitals optimization)
触发条件:
  • 为网页添加富文本片段资格
  • 实现产品、文章、FAQ、操作指南(HowTo)或活动类型的标记
  • 调试Google搜索控制台中的结构化数据错误
不适用场景:
  • 优化页面内容或关键词时(请使用内容SEO技能)
  • 提升页面加载速度时(请使用核心网页指标优化技能)

Algorithm

算法

IRON LAW: Schema Markup Must MATCH Visible Content
Marking up content that users can't see violates Google guidelines
and risks manual penalties. Every structured data field must
correspond to content visible on the page.
铁律:Schema标记必须与可见内容匹配
标记用户不可见的内容违反Google指南,可能会导致人工处罚。每个结构化数据字段都必须与页面上的可见内容对应。

Phase 1: Input Validation

第一阶段:输入验证

Identify page type (Article, Product, FAQ, HowTo, Event, etc.). Map visible content to required and recommended schema properties. Gate: Page type identified, all required properties have visible content.
识别页面类型(文章、产品、FAQ、操作指南、活动等),将可见内容映射到schema的必填和推荐属性。 **准入条件:**已识别页面类型,所有必填属性均有对应的可见内容。

Phase 2: Core Algorithm

第二阶段:核心算法

  1. Select the correct Schema.org type from the vocabulary
  2. Map page content to schema properties (name, description, image, etc.)
  3. Build JSON-LD object with @context and @type
  4. Handle nested types (e.g., Product contains Offer contains Price)
  5. Place JSON-LD in
    <script type="application/ld+json">
    in
    <head>
  1. 从词汇表中选择正确的Schema.org类型
  2. 将页面内容映射到schema属性(名称、描述、图片等)
  3. 构建包含@context和@type的JSON-LD对象
  4. 处理嵌套类型(例如:Product包含Offer,Offer包含Price)
  5. 将JSON-LD放置在
    <head>
    标签内的
    <script type="application/ld+json">
    标签中

Phase 3: Verification

第三阶段:验证

Validate with Google Rich Results Test. Check: no errors, all required fields present, no mismatch with visible content. Gate: Passes Google Rich Results Test with zero errors.
使用Google富媒体结果测试工具进行验证,检查:无错误、所有必填字段均已填充、与可见内容无不匹配。 **准入条件:**通过Google富媒体结果测试且无错误。

Phase 4: Output

第四阶段:输出

Return complete JSON-LD markup ready for insertion.
返回可直接插入的完整JSON-LD标记。

Output Format

输出格式

json
{
  "schema": {"@context": "https://schema.org", "@type": "Product", "name": "...", "offers": {"@type": "Offer", "price": "29.99", "priceCurrency": "TWD"}},
  "validation": {"errors": 0, "warnings": 1, "eligible_rich_results": ["Product snippet"]}
}
json
{
  "schema": {"@context": "https://schema.org", "@type": "Product", "name": "...", "offers": {"@type": "Offer", "price": "29.99", "priceCurrency": "TWD"}},
  "validation": {"errors": 0, "warnings": 1, "eligible_rich_results": ["Product snippet"]}
}

Examples

示例

Sample I/O

输入输出示例

Input: FAQ page with 3 questions and answers Expected: FAQPage schema with 3 Question/Answer pairs in JSON-LD
**输入:**包含3个问答的FAQ页面 **预期输出:**包含3组问答对的FAQPage类型JSON-LD schema

Edge Cases

边缘案例

InputExpectedWhy
Page with no clear typeUse WebPage as fallbackMost generic valid type
Multiple schemas neededArray of JSON-LD objectsOne page can have multiple types
Missing required fieldError, do not generateIncomplete schema hurts more than none
输入预期输出原因
无明确类型的页面使用WebPage作为 fallback最通用的有效类型
需要多个schemaJSON-LD对象数组单个页面可包含多种类型
缺少必填字段返回错误,不生成标记不完整的schema比没有更糟

Gotchas

注意事项

  • Required vs recommended: Google requires certain fields per type. Missing required fields = schema ignored entirely. Check documentation per type.
  • Nesting depth: Deeply nested schemas (Product > Offer > Seller > Address) are error-prone. Validate each nesting level.
  • Schema spam: Adding schema for content not on the page (fake reviews, unavailable prices) triggers manual actions.
  • Type specificity: Use the most specific type available. "Article" is better than "WebPage"; "NewsArticle" is better than "Article" for news content.
  • Testing gap: Google Rich Results Test shows what Google sees, but not all valid schema triggers rich results. Eligibility ≠ guarantee of display.
  • 必填与推荐字段:Google针对不同类型要求特定字段,缺少必填字段会导致schema被完全忽略,请查阅对应类型的文档。
  • 嵌套深度:深度嵌套的schema(如Product > Offer > Seller > Address)容易出错,需验证每个嵌套层级。
  • Schema垃圾信息:为页面上不存在的内容添加schema(如虚假评价、不存在的价格)会触发人工处罚。
  • 类型特异性:使用最具体的可用类型。对于新闻内容,“Article”比“WebPage”更好,“NewsArticle”比“Article”更好。
  • 测试局限性:Google富媒体结果测试工具展示的是Google能识别的内容,但并非所有有效的schema都会触发富媒体结果。符合资格不代表一定会被展示。

References

参考资料

  • For complete property reference by type, see
    references/type-properties.md
  • For common validation errors and fixes, see
    references/validation-errors.md
  • 如需按类型查看完整的属性参考,请查看
    references/type-properties.md
  • 如需了解常见验证错误及修复方法,请查看
    references/validation-errors.md