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 authored Jun 9, 2022
1 parent 3c4b32e commit 8bc3796
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions templates/_partials/microdata/product-jsonld.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@
"@type": "Brand",
"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 isset($nbComments) && $nbComments && $ratings.avg}"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "{$ratings.avg|round:1|escape:'html':'UTF-8'}",
Expand Down

0 comments on commit 8bc3796

Please sign in to comment.