问题
The schema.org docs refer sometimes to "pointers". E.g. Product schema has the property isSimilarTo
.
I do understand, that I could use a Product
or a Service
directly. E.g.:
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "BMW",
"isSimilarTo": {
"@type": "Product",
"name": "Mercedes Benz"
},
"offers": {
"@type": "Offer",
"priceCurrency": "EUR",
"price": "100000.00"
}
}
</script>
Is this the only and the correct way using and interpreting the term 'pointer' in this context? For a pointer, I would rather expect some value (an ID or an URL or similar) just pointing to another product or service.
回答1:
Your example is correct, and it follows Schema.org’s recommendation for the expected value of the isSimilarTo property. But Schema.org allows URI values for each property, even for those that don’t explicitly list URL
as expected value.
So you could also use:
"isSimilarTo": {
"@id": "https://example.com/products/mercedes-benz#this"
},
Note that consumers (like Google) don’t necessarily follow these references. You could also use both ways: provide the data (or some of it) on the current page, and refer to the item’s URI:
"isSimilarTo": {
"@id": "https://example.com/products/mercedes-benz#this",
"@type": "Product",
"name": "Mercedes Benz",
"url": "https://example.com/products/mercedes-benz"
},
来源:https://stackoverflow.com/questions/41697456/what-exactly-are-pointers-in-schema-org-and-how-to-use-them-with-json-ld