跳转到主要内容

Schema.org 实战

3.1 什么是Schema.org

Schema.org 是由Google、Microsoft、Yahoo、Yandex联合创建的结构化数据标准。它定义了一套统一的词汇表,让网页内容变成机器可读的。 通俗解释: 你的网页上写着”Nike Air Max 90,¥899,有库存”。人能读懂,但机器看到的只是一段文本。Schema.org标记告诉机器:这是一个”Product”,名字是”Nike Air Max 90”,价格是”899 CNY”,库存状态是”InStock”。 对AI代理的影响: AI代理(ChatGPT、Claude、Gemini等)在推荐商品时,优先处理有结构化数据的页面,因为它们能准确提取商品信息,减少误解和幻觉。

3.2 Schema.org的三种实现格式

格式推荐程度说明
JSON-LD推荐Google官方推荐。独立的 <script> 标签,不影响HTML结构
Microdata可用内嵌在HTML标签属性中(itempropitemscope
RDFa不推荐较旧的格式,使用率低
为什么推荐JSON-LD:
  • 和HTML完全分离,维护方便
  • 可以用后端动态生成
  • AI代理解析效率最高
  • Google官方明确推荐

3.3 电商必备:Product标记

一个完整的Product标记示例:
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "经典帆布运动鞋",
  "description": "舒适透气的经典帆布鞋,适合日常穿着。",
  "image": [
    "https://example.com/photos/shoe-1.jpg",
    "https://example.com/photos/shoe-2.jpg"
  ],
  "brand": {
    "@type": "Brand",
    "name": "ExampleBrand"
  },
  "sku": "SHOE-001",
  "gtin13": "1234567890123",
  "offers": {
    "@type": "Offer",
    "url": "https://example.com/shoe-001",
    "priceCurrency": "CNY",
    "price": "299.00",
    "availability": "https://schema.org/InStock",
    "seller": {
      "@type": "Organization",
      "name": "Example Store"
    },
    "shippingDetails": {
      "@type": "OfferShippingDetails",
      "shippingDestination": {
        "@type": "DefinedRegion",
        "addressCountry": "CN"
      },
      "deliveryTime": {
        "@type": "ShippingDeliveryTime",
        "businessDays": {
          "@type": "QuantitativeValue",
          "minValue": 1,
          "maxValue": 3
        }
      }
    },
    "hasMerchantReturnPolicy": {
      "@type": "MerchantReturnPolicy",
      "returnPolicyCategory": "https://schema.org/MerchantReturnFiniteReturnWindow",
      "merchantReturnDays": 30
    }
  },
  "aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.6",
    "reviewCount": "128"
  }
}
</script>
必填字段清单:
字段重要性说明
name必填商品名称
description必填商品描述
image必填至少一张高质量图片URL
offers.price必填价格
offers.priceCurrency必填货币代码(CNY/USD/EUR等)
offers.availability必填库存状态
brand强烈推荐品牌名称
sku推荐商品唯一编号
gtin13 / gtin14推荐国际商品条码
aggregateRating推荐评分汇总
shippingDetails推荐配送信息
hasMerchantReturnPolicy推荐退货政策

3.4 公司信息:Organization标记

除了商品,你的公司信息也需要结构化。放在首页或”关于我们”页面:
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "公司名称",
  "url": "https://example.com",
  "logo": "https://example.com/logo.png",
  "description": "一句话描述公司业务",
  "foundingDate": "2020-01-01",
  "address": {
    "@type": "PostalAddress",
    "streetAddress": "具体地址",
    "addressLocality": "城市",
    "addressRegion": "省份",
    "postalCode": "邮编",
    "addressCountry": "CN"
  },
  "contactPoint": {
    "@type": "ContactPoint",
    "contactType": "customer service",
    "email": "support@example.com",
    "telephone": "+86-xxx-xxxx-xxxx"
  },
  "sameAs": [
    "https://weibo.com/example",
    "https://www.linkedin.com/company/example"
  ]
}
</script>

3.5 面包屑导航:BreadcrumbList

帮助AI代理理解你的网站结构层级:
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "首页",
      "item": "https://example.com"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "运动鞋",
      "item": "https://example.com/category/sneakers"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "经典帆布运动鞋"
    }
  ]
}
</script>

3.6 常见错误

错误后果修复方法
价格缺少货币代码AI无法比价始终填写 priceCurrency
库存状态缺失AI不知道能不能买动态更新 availability
图片用相对路径AI抓取失败使用完整的 https:// URL
标记和页面内容不一致被搜索引擎惩罚保持标记数据和可见内容一致
嵌套JSON格式错误解析失败用验证工具检查

3.7 验证工具

配置完Schema.org标记后,用以下工具验证:
  1. Google Rich Results Test — 检测标记是否正确,是否能触发富结果
  2. Schema.org Validator — 官方验证工具
  3. 浏览器开发者工具 — 查看页面源代码中的 <script type="application/ld+json"> 内容

3.8 自检清单

  • 每个商品页面都有 Product JSON-LD标记
  • Product标记包含name、description、image、price、availability
  • 首页或关于页有 Organization JSON-LD标记
  • 分类页面有 BreadcrumbList 标记
  • 用Google Rich Results Test验证至少3个页面
  • 标记数据和页面可见内容一致

下一章: JSON-LD vs Microdata — 两种格式的技术对比和迁移指南