How can I add multiple reviews to a product snippet?
Asked Answered
S

2

7

I am trying to create a product snippet in JSON-LD with multiple reviews. 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 ). 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". How can I include the review of Sarah in the code below?

 {
   "@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"
     }

}


}
Spalding answered 1/12, 2017 at 3:20 Comment(2)
Can you include an example that shows what you tried?Anticline
google [array] to see how to construct an [array]Dodgson
C
11

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>
Colic answered 23/7, 2019 at 9:15 Comment(0)
D
0

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. Then create another snippet for "Sarah"

Here's a some boilerplate JSON-LD for a review

<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.

As an alternative, I have the equivalent of this working on a site. I've removed the individual review and modified your aggregateRating block

<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!

Dennett answered 2/12, 2017 at 13:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.