schema.org - SDTT 警告:“Google 无法识别 Product 类型对象的属性 priceSpecification。”
问题描述
我有以下 JSON-LD 并试图代表一种按月付费的产品,例如包含预付费用和月费的手机合同。
当我尝试添加时unitCode
,我收到以下警告:
priceSpecification
Google 无法识别类型为 的对象的属性Product
。
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Apple iPhone",
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"description": "Apple iPhone XS ...",
"sku": "0446310786",
"mpn": "925872",
"brand": {
"@type": "Thing",
"name": "ACME"
},
"review": {
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4",
"bestRating": "5"
},
"author": {
"@type": "Person",
"name": "Fred Benson"
}
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.4",
"reviewCount": "89"
},
"offers": {
"@type": "Offer",
"url": "https://example.com/anvil",
"priceCurrency": "GBP",
"price": "39.99",
"priceValidUntil": "2020-11-05",
"itemCondition": "https://schema.org/UsedCondition",
"availability": "https://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "Executive Objects"
}
},
"priceSpecification": {
"@type": "UnitPriceSpecification",
"price": "25",
"priceCurrency": "GBP",
"referenceQuantity": {
"unitCode": "MON"
}
}
}
解决方案
您需要将priceSpecification
属性添加到Offer
,而不是Product
。
{
"@context": "https://schema.org/",
"@type": "Product",
"offers": {
"@type": "Offer",
"priceSpecification": {
"@type": "UnitPriceSpecification"
}
}
}
您可以在其页面上找到属性的预期域/范围。对于priceSpecification
,它说:
用于这些类型
Demand
Offer
TradeAction
因此,预计不会在Product
.
推荐阅读
- redis - 如何在 Lua 脚本中将 ...array 传递给 redis rpush?
- node.js - FS 用于跨平台开发
- java - 没有为每个请求创建新的 HashMap 实例变量?
- python - 使用特定 OpenCV 功能时,Keras 模型不使用 GPU?
- flutter - 'Pub get' 尚未运行 - Flutter 依赖项错误
- php - php上次上线
- ruby-on-rails - 我们如何在rails中将markdown文件转换为trix编辑器格式
- javascript - NodeJS/Express:解析 csv 文件不会返回正确的数组
- node.js - 猫鼬中未调用 userSchema.methods 函数
- go - 如果文件夹名称与现有文件相同,则 mkdir 失败