I am trying to create some JSON-LD structured data for a list of products on an ecom-site but I am getting an error when using Google's Structured Data Testing Tool.
So far, I have this:
{
"@context": "http://schema.org",
"@type": "OfferCatalog",
"name": "Fresh Fruit",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item":
{
"@type": "Offer",
"price": "1.20",
"priceCurrency": "GBP",
"availability": "http://schema.org/InStock",
"url": "http://example.com/green-apples/",
"itemOffered": {
"@type": "Product",
"name": "Green Apples",
"url": "http://example.com/green-apples/"
}
}
}
]
}
Mostly it validates, but the Google tool throws the following error:
All values provided for url must point to the same page.
The error highlights line 11 ("@type": "Offer",
).
The URL fields seem to be clashing with the (This has been shown to be a red-herring, in the comments below)@context
declaration, because if I change the context to either a non-url string or http://example.com
, it validates (although, this obviously causes its own issues).
What am I missing here? It feels like something blindingly obvious.
I think it is connected with pushing of accelerated mobile pages and its structured data.
Please check my thoughts here: All values provided for URL must point to the same page. My guess was about the problem in Google’s SDTT
So, to fix the problem with your structure data, please use the correct version of ItemList (there are Separately and Combined marked up ItemLists, please check here):
If your items are on the same page, please use the version with items inside, the Combined one.
Otherwise, if you point to different pages inside and your items are not on one page, please DON’T put item element with type and other description inside, the Separately marked up one.