Skip to content

Commit

Permalink
Add products reviews to schema.org
Browse files Browse the repository at this point in the history
  • Loading branch information
rodriciru committed Jun 27, 2023
1 parent c9e964b commit 0295657
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions templates/_partials/microdata/product-jsonld.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,33 @@
"brand": {
"@type": "Thing",
"name": "{if $product_manufacturer->name}{$product_manufacturer->name|escape:'html':'UTF-8'}{else}{$shop.name}{/if}"
}
},{/if}
{if !empty($product.productComments.comments)}
"review": [
{foreach from=$product.productComments.comments item=comment}
{
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": "{$comment.grade}",
"datePublished": "{$comment.date_add}"
},
"name": "{$comment.title}",
"author": {
"@type": "Person",
"name": "{$comment.customer_name}"
},
"reviewBody": "{$comment.content}"
}
{/foreach}
],
{/if}
{if $hasAggregateRating},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{$ratingValue|round:1|escape:'html':'UTF-8'}",
"reviewCount": "{$ratingReviewCount|escape:'html':'UTF-8'}"
}
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{$ratingValue|round:1|escape:'html':'UTF-8'}",
"reviewCount": "{$ratingReviewCount|escape:'html':'UTF-8'}"
}
{/if}
{if $hasWeight},
"weight": {
Expand Down

0 comments on commit 0295657

Please sign in to comment.