Google Search Console 报 Product 结构化数据错误?换个 Schema 类型就好了
最近收到 Google Search Console 的邮件,说我的网站有结构化数据问题:
Product snippets structured data issues detected in verysmallwoods.com
Either 'offers', 'review' or 'aggregateRating' should be specified
这个错误属于"Critical issues",会导致页面无法在搜索结果中展示富媒体摘要(Rich Results)。
研究了一下 Google 的规范,发现问题不在于缺少价格信息,而在于我一开始就用错了 Schema 类型。
问题背景
我的产品页面展示了课程、书籍、App 等内容。之前为了让 Google 更好地理解页面内容,我给每个项目都加上了 Product 类型的结构化数据:
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'ItemList',
itemListElement: products.map((product, index) => ({
'@type': 'Product', // 所有项目都用 Product
position: index + 1,
name: product.title,
description: product.description,
url: product.ctaUrl,
image: product.image,
})),
};
看起来没问题,但 Google 不买账。
Google 对 Product Schema 的要求
根据 Google 官方文档,Product 结构化数据必须包含以下三个属性之一:
| 属性 | 说明 |
|---|---|
offers | 价格和库存信息 |
review | 用户评价 |
aggregateRating | 评分汇总 |
这是硬性要求。如果三个都不提供,Google 会判定你的 Product 标记无效,不会展示任何富媒体摘要。
为什么 Google 这样要求?
Google 的 Product Schema 主要服务于电商场景。在搜索结果中展示产品时,用户最关心的是:
- 多少钱?(offers)
- 评价怎么样?(review / aggregateRating)
没有这些信息的"产品",对搜索用户来说价值有限。所以 Google 干脆把它们设为必填。
Product Snippets vs Merchant Listings
Google 实际上区分了两种产品标记:
- Product Snippets:适用于产品评测、编辑推荐等非购买页面,强调评价信息
- Merchant Listings:适用于可直接购买的商品页面,强调价格和库存
但无论哪种,都需要 offers、review 或 aggregateRating 中的至少一个。
解决思路
面对这个问题,有几个选项:
选项 1:硬着头皮加 offers
给每个项目添加价格信息。但我的内容链接到外部平台(B站课程、京东图书),价格可能随时变化,维护成本高。
选项 2:加 review 或 aggregateRating
添加评分信息。但我没有评分系统,伪造数据不仅违反 Google 政策,还可能被惩罚。
选项 3:换用更合适的 Schema 类型
既然不是传统意义上的"商品",为什么要用 Product?Schema.org 提供了更多选择。
我选择了选项 3。
解决方案:使用类型特定的 Schema
Schema.org 定义了很多内容类型,每种类型有不同的属性要求:
| 内容类型 | 推荐 Schema | 必填属性 |
|---|---|---|
| 在线课程 | Course | 无硬性要求 |
| 书籍 | Book | 无硬性要求 |
| 软件/App | SoftwareApplication | 无硬性要求 |
| 服务/会员 | Service | 无硬性要求 |
这些类型都不要求 offers、review 或 aggregateRating。
基于这个思路,我重构了结构化数据的生成逻辑。
修改后的代码
// 根据产品类型返回对应的 Schema 类型
const getSchemaType = (type: Product['type']) => {
switch (type) {
case 'course':
return 'Course';
case 'book':
return 'Book';
case 'product':
return 'SoftwareApplication';
case 'service':
case 'membership':
return 'Service';
default:
return 'Thing';
}
};
// 根据类型添加特定属性
const getSchemaItem = (product: Product, index: number) => {
const baseSchema = {
'@type': getSchemaType(product.type),
position: index + 1,
name: product.title,
description: product.description,
url: product.ctaUrl,
image: product.image,
};
switch (product.type) {
case 'course':
return {
...baseSchema,
provider: {
'@type': 'Organization',
name: site.author,
url: site.url,
},
};
case 'book':
return {
...baseSchema,
author: {
'@type': 'Person',
name: site.author,
},
};
case 'product':
return {
...baseSchema,
applicationCategory: 'LifestyleApplication',
operatingSystem: 'iOS, Android',
};
default:
return baseSchema;
}
};
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'ItemList',
itemListElement: products.map((product, index) =>
getSchemaItem(product, index)
),
};
代码的核心逻辑是根据内容类型动态选择 Schema,并为每种类型添加相关属性。
每种类型的推荐属性
虽然这些 Schema 类型没有硬性必填属性,但添加相关属性可以让 Google 更好地理解你的内容:
Course(课程)
provider:课程提供者(个人或机构)educationalLevel:难度级别teaches:教授的技能
Book(书籍)
author:作者isbn:ISBN 号publisher:出版社numberOfPages:页数
SoftwareApplication(软件)
applicationCategory:应用类别operatingSystem:支持的操作系统softwareVersion:版本号
Service(服务)
provider:服务提供者serviceType:服务类型
验证和部署
修改完成后,可以用以下工具验证:
- Google Rich Results Test:测试页面是否符合富媒体摘要要求
- Schema Markup Validator:验证 Schema 语法是否正确
部署后,在 Google Search Console 中:
- 进入"增强功能"→"Product snippets"
- 点击"验证修复"请求重新检测
Google 通常需要几天到几周时间完成重新爬取和验证。
什么时候该用 Product Schema?
如果你的页面确实是商品页面,建议还是用 Product 并提供完整信息:
{
'@type': 'Product',
name: '产品名称',
description: '产品描述',
image: 'https://example.com/image.jpg',
offers: {
'@type': 'Offer',
price: 99.00,
priceCurrency: 'CNY',
availability: 'https://schema.org/InStock',
url: 'https://example.com/buy',
},
}
如果有评分系统,也可以添加:
{
'@type': 'Product',
// ...其他属性
aggregateRating: {
'@type': 'AggregateRating',
ratingValue: 4.5,
reviewCount: 128,
},
}
总结
收到"Either 'offers', 'review' or 'aggregateRating' should be specified"错误时:
- 先问自己:这个内容真的是"商品"吗?
- 如果是:添加价格、评价或评分信息
- 如果不是:换用更合适的 Schema 类型(Course、Book、SoftwareApplication、Service 等)
不是所有内容都适合用 Product。选择正确的 Schema 类型,既能消除 Google 警告,也能让搜索引擎更准确地理解你的内容。
参考链接
- Google Product Structured Data 官方文档
- Google Product Snippets 文档
- Schema.org Course
- Schema.org Book
- Schema.org SoftwareApplication
- Google Rich Results Test