[英]How can I add multiple reviews to a product snippet?
I am trying to create a product snippet in JSON-LD with multiple reviews. 我试图在JSON-LD中创建具有多个评论的产品代码段。 The code below works when I include only one review.
当我仅包含一个评论时,以下代码有效。 (please copy paste the code fragment in the console on the following url to test it: https://search.google.com/structured-data/testing-tool ).
(请将代码片段复制粘贴到控制台中的以下URL上以对其进行测试: https : //search.google.com/structured-data/testing-tool )。 However it is unclear for me how I can add multiple reviews.
但是,对于我来说,尚不清楚如何添加多个评论。 After struggling for some time I can't get it to work myself and I am having a hard time to find an example.
经过一段时间的努力,我自己无法工作,我很难找到一个例子。
Let's say I have a review from "John" who gives the product rating of a "3.0" and another review of "Sarah" who gives the product a rating of "5.0". 假设我有“约翰”的评论,他给产品评分为“ 3.0”,还有另一条“莎拉”评论,给产品评分为“ 5.0”。 How can I include the review of Sarah in the code below?
我如何在下面的代码中包含对Sarah的评论?
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "Samsung Galaxy S",
"description": "A great product",
"brand": {
"@type": "Thing",
"name": "Samsung"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.0",
"reviewCount": "103"
},
"offers": {
"@type": "Offer",
"priceCurrency": "EUR",
"price": "18",
"itemCondition": "http://schema.org/NewCondition",
"availability": "http://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "Samsung"
}
}
,"review": {
"@type": "Review",
"author": "John",
"datePublished": " 7 December 2016",
"description": "I love this product so much",
"name": "Amazing",
"reviewRating": {
"@type": "Rating",
"bestRating": "5",
"ratingValue": "3.0",
"worstRating": "1"
}
}
}
You can attach multiple JSON-LD snippets to a single page, so there's no reason why you couldn't remove the review data from you sample, and move it to a standalone snippet. 您可以将多个JSON-LD代码段附加到单个页面上,因此没有理由无法从示例中删除评论数据,并将其移动到独立代码段中。 Then create another snippet for "Sarah"
然后为“ Sarah”创建另一个代码段
Here's a some boilerplate JSON-LD for a review 这是一些样板JSON-LD进行审查
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"image": "http://www.example.com/iphone-case.jpg",
"name": "The Catcher in the Rye",
"review": {
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4"
},
"name": "iPhone 6 Case Plus",
"author": {
"@type": "Person",
"name": "Linus Torvalds"
},
"datePublished": "2016-04-04",
"reviewBody": "I loved this case, it is strurdy and lightweight. Only issue is that it smudges.",
"publisher": {
"@type": "Organization",
"name": "iPhone 6 Cases Inc."
}
}
}
</script>
If you test this approach with multiple snippets on https://search.google.com/structured-data/testing-tool you'll see that it will validate. 如果您在https://search.google.com/structured-data/testing-tool上使用多个代码片段测试了此方法,则会看到它将会验证。
As an alternative, I have the equivalent of this working on a site. 另外,我也可以在网站上进行等效的操作。 I've removed the individual review and modified your aggregateRating block
我已经删除了单个评论并修改了您的aggregateRating块
<script type="application/ld+json"> {
"@context": "http://schema.org/",
"@type": "Product",
"name": "Samsung Galaxy S",
"description": "A great product",
"brand": {
"@type": "Thing",
"name": "Samsung"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4",
"reviewCount": "103",
"worstRating": "1",
"bestRating": "5"
},
"offers": {
"@type": "Offer",
"priceCurrency": "EUR",
"price": "18",
"itemCondition": "http://schema.org/NewCondition",
"availability": "http://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "Samsung"
}
}
}</script>
Good luck! 祝好运!
You can specify review as an array, 您可以将评论指定为数组,
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"image": "http://www.example.com/iphone-case.jpg",
"name": "The Catcher in the Rye",
"review": [
{
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4"
},
"name": "iPhone 6 Case Plus",
"author": {
"@type": "Person",
"name": "Linus Torvalds"
},
"datePublished": "2016-04-04",
"reviewBody": "I loved this case, it is strurdy and lightweight. Only issue is that it smudges.",
"publisher": {
"@type": "Organization",
"name": "iPhone 6 Cases Inc."
}
},
{
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": "4"
},
"name": "iPhone 6 Case Plus+",
"author": {
"@type": "Person",
"name": "Linus Torvalds"
},
"datePublished": "2019-04-04",
"reviewBody": "I loved this case, it is strurdy and lightweight. Only issue is that it smudges.",
"publisher": {
"@type": "Organization",
"name": "iPhone 6 Cases Inc."
}
}
]
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.