问题
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:
One of offers or review or aggregateRating should be provided.
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 {}
}
}
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.
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.
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"
}
}
]
}
回答1:
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"
}
}]
}
Googles Schema Documentation on Offer
states that itemOffered
is a recommended field and that it's "typically a product", but doesn't have to be. It's also worth noting that contrary to the documentation, the tool does not warn you if itemOffered
does not exist in Offer
Even though schema.org provides itemsOffered
as an option unfortunately there is no example of that with nested Product
s.
Nesting Products
or Services
could make sense in the following scenarios:
- (Product) Salon Package
- (Offer) Nail/Massage Combo
- (ItemOffered)
- (Service) Nail polishing and Neck Massage
- (ItemOffered)
- (Offer) Nail/Massage Combo
or:
- (Product) Sweater
- (Offer) Blue Sweater
- (ItemOffered)
- (Product) Blue Sweater
- (Offer) Blue Sweater on Amazon - $49
- (Offer) Blue Sweater on eBay - $39
- (Product) Blue Sweater
- (ItemOffered)
- (Offer) Red Sweater ...
- (Offer) Blue Sweater
Either way, I think the expectation makes sense here, the Product
in any scenario will eventually end with Offer
. In your case, I believe the fix would be to not use nested Product
s only to describe the Offer
.
来源:https://stackoverflow.com/questions/58738927/how-do-i-correctly-markup-a-product-within-an-offer-within-a-product