如何在产品内的要约中正确标记产品? [英] How do I correctly markup a Product within an Offer within a Product?
问题描述
我维护的网站的产品"页面上出现Google Search Console错误,我不确定如何解决这些错误.我收到的错误是:
I am getting Google Search console errors on the Product pages for a website I maintain, and I'm not sure how to resolve the errors. The error I'm getting is:
要约或评论或 aggregateRating 之一.
One of offers or review or aggregateRating should be provided.
这很容易正常修复,但是我的困惑是我已经在json ld的不同部分中提供了offers
数据.我的产品json ld的结构是
This is simple enough to fix normally, however my confusion is that I am already providing the offers
data in a different portion of the json ld. The structure of my Product json ld is
Product{
Offers{
Product {}
Product {}
}
}
其中嵌套产品是同一产品的不同变体.我在网站上没有可用的评论或评分,因此留给我offers
来解决错误.但是,谷歌搜索控制台说,每个嵌套产品都应具有offers
数据,尽管它们已经包含在商品结构中.
Where the nested products are the different variants of the same product. I don't have reviews or ratings available on the site, so that leaves me with offers
to resolve the error. However google search console is saying that each of the nested products should have offers
data, despite the fact that they are already contained within an offers structure.
这似乎将陷入一个无限循环:我向商品变体中添加商品,商品的itemOffered类型,然后需要其他商品,等等.
This seems like it will dig down into an infinite loop: I add offers to the product variants, with an itemOffered type of Product, which will then require another offer, etc.
如何组织结构化数据以既支持我的产品->变体层次结构,又要取悦Google Search Console并消除我看到的错误?
How can I organize my structured data to both support my product -> variants hierarchy, while also pleasing google search console and removing the errors I'm seeing?
Here's the full JSON ld that you can directly copy/paste into the Structured Data Testing Tool to see the exact issue I'm describing.
{
"@context":"http://schema.org/",
"@type":"Product",
"name":"Stripe Knit Sweater",
"url":"http://foobar.gov/product",
"image":[
"http://foobar.gov/product/image1"
],
"description":"this is a description",
"brand":{
"@type":"Thing",
"name":"My Store"
},
"offers":[
{
"@type":"Offer",
"availability":"http://schema.org/InStock",
"price":"64.0",
"priceCurrency":"USD",
"url":"http://foobar.gov/product/url",
"itemOffered":{
"@type":"Product",
/*ERROR IS HERE! : One of offers or review or aggregateRating should be provided.*/
"image":"http://foobar.gov/product/url",
"name":"Small / Blue/Black/Cream Stripe",
"weight":{
"@type":"QuantitativeValue",
"unitCode":"lb",
"value":"0.0 lb"
},
"url":"http://foobar.gov/product/url"
}
},
{
"@type":"Offer",
"availability":"http://schema.org/InStock",
"price":"64.0",
"priceCurrency":"USD",
"url":"http://foobar.gov/product/url",
"itemOffered":{
"@type":"Product",
/*ERROR IS HERE! : One of offers or review or aggregateRating should be provided.*/
"image":"http://foobar.gov/product/url",
"name":"Medium / Blue/Black/Cream Stripe",
"weight":{
"@type":"QuantitativeValue",
"unitCode":"lb",
"value":"0.0 lb"
},
"url":"http://foobar.gov/product/url"
}
}
]
}
推荐答案
根据您的示例,似乎每个Offer
都是Product
的变体.如果是这种情况,我不确定是否需要在变体中嵌套Product
.据我所知,嵌套的Product
中唯一的唯一属性是weight
,您可以使用additionalProperty
将其应用于Offer
.
Based on your example it seems that each Offer
is a variant of Product
. If that's the case, I'm not sure nesting Product
inside of a variant would be needed. As far as I can tell from your example the only property in the nested Product
which is unique is weight
, which you could apply to Offer
using additionalProperty
.
如果以这种方式发送给该工具,则所有内容都会验证:
If sent this way to the tool everything will validate:
{
"@context": "http://schema.org/",
"@type": "Product",
"name":"Stripe Knit Sweater",
"url":"http://foobar.gov/product",
"image":[
"http://foobar.gov/product/image1"
],
"description":"this is a description",
"brand":{
"@type":"Thing",
"name":"My Store"
},
"offers": [
{
"@type": "Offer",
"availability":"http://schema.org/InStock",
"price":"64.0",
"image":"http://foobar.gov/product/url",
"name":"Small / Blue/Black/Cream Stripe",
"priceCurrency":"USD",
"url":"http://foobar.gov/product/url",
"additionalProperty": {
"@type": "PropertyValue",
"name": "Weight",
"unitCode": "1b",
"value": "0.0lb"
}
},
{
"@type": "Offer",
"availability":"http://schema.org/InStock",
"price":"64.0",
"image":"http://foobar.gov/product/url",
"name":"Medium / Blue/Black/Cream Stripe",
"priceCurrency":"USD",
"url":"http://foobar.gov/product/url",
"additionalProperty": {
"@type": "PropertyValue",
"name": "Weight",
"unitCode": "1b",
"value": "0.0lb"
}
}]
}
Offer
上的
Google架构文档指出Offer
即使 schema.org 提供itemsOffered
作为选项,不幸的是,没有嵌套的示例Product
s.
Even though schema.org provides itemsOffered
as an option unfortunately there is no example of that with nested Product
s.
嵌套Products
或Services
可能有意义:
- (产品)沙龙套餐
- (提供)指甲/按摩组合
- (已提供Item)
- (服务)指甲抛光和颈部按摩
- (Product) Salon Package
- (Offer) Nail/Massage Combo
- (ItemOffered)
- (Service) Nail polishing and Neck Massage
或:
- (产品)毛衣
- (优惠)蓝色毛衣
- (已提供Item)
- (产品)蓝色毛衣
- (在亚马逊上提供)蓝色毛衣-49美元
- 在eBay上(提供)蓝色毛衣-39美元
- (Product) Sweater
- (Offer) Blue Sweater
- (ItemOffered)
- (Product) Blue Sweater
- (Offer) Blue Sweater on Amazon - $49
- (Offer) Blue Sweater on eBay - $39
无论哪种方式,我认为这里的期望都是有意义的,在任何情况下,
Product
最终都将以Offer
结尾.对于您的情况,我认为解决方法是不要只使用嵌套的Product
来描述Offer
.Either way, I think the expectation makes sense here, the
Product
in any scenario will eventually end withOffer
. In your case, I believe the fix would be to not use nestedProduct
s only to describe theOffer
.这篇关于如何在产品内的要约中正确标记产品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- (Product) Blue Sweater
- (ItemOffered)
- (Offer) Blue Sweater
- (产品)蓝色毛衣
- (已提供Item)
- (优惠)蓝色毛衣
- (ItemOffered)
- (Offer) Nail/Massage Combo
- (已提供Item)
- (提供)指甲/按摩组合