JSON-LD 为人员创建单个评论

JSON-LD Create Single Review for Person

您会如何为某人创建评论?例如,如果用户提交了评论,其中提供了评级和有关个人 s/service 提供商服务质量的相关信息……应该如何使用 JSON-LD 进行编码?我认为下面的代码是您正确完成此操作的方式,但我不完全确定。如果您有任何建议,请在您的输入中包含代码以提供最大的清晰度。

请记住,下面的代码不是针对列出所有评分的页面,而是针对仅显示此评分的单个页面。

Person/Service 单条评论:

<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Review",
  "itemReviewed": {
    "@type": "Person",
    "name": "John Smith", // Person being reviewd
  },
  "reviewRating": {
    "@type": "Rating",
    "bestRating": "5",
    "ratingValue": "3",
    "worstRating": "1"
  }
  "name": "Excellent Service!",
  "author": {
    "@type": "Person",
    "name": "Bob Smith"
  },
  "reviewBody": "John provided excellent service!"
}
</script>

参考:https://developers.google.com/structured-data/rich-snippets/reviews

除了注释和两个逗号错误之外,这是有效的 JSON-LD。不过,我不希望它显示为丰富的摘要。您引用的页面列出了支持评论的 entitz 类型:"We support reviews and ratings for a wide range of schema.org types, including businesses, products, and different creative works such as books or movies." 如果可能,我会因此将 Review 关联到 Service (这个人可以成为 provider 的服务)。

以下是修复了两个小语法问题的片段:

<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Review",
  "itemReviewed": {
    "@type": "Person",
    "name": "John Smith"
  },
  "reviewRating": {
    "@type": "Rating",
    "bestRating": "5",
    "ratingValue": "3",
    "worstRating": "1"
  },
  "name": "Excellent Service!",
  "author": {
    "@type": "Person",
    "name": "Bob Smith"
  },
  "reviewBody": "John provided excellent service!"
}
</script>