问题
I am implementing structured data (schema.org) for my website.
I am stuck at putting in ratingValue
and reviewCount
, everything else I am able to put in dynamically.
"review": [
{
"@type": "Review",
"reviewRating":{
"@type": "Rating",
"ratingValue": "4",
"bestRating": "5"
},
"author":{
"@type": "Organization",
"name": "xyz"
}
}
],
"aggregateRating":
{
"@type": "AggregateRating",
"ratingValue": "3.7",
"reviewCount": "15"
}
Where I can put reviewCount
and ratingValue
?
We are not asking our customers to give any reviews/ratings
回答1:
I think in your case using AggregateRating
doesn't make sense, since there's only a single review by the (assumed) website author. "Aggregate" basically means "the summary of a collection", so to use AggregateRating
you're stating there are or could be multiple reviews - not just a single one.
Assuming this is a Product
, I would instead use this markup:
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "Some Product",
"description": "This is some product",
"review": {
"@type": "Review",
"author": {
"@type": "Organization",
"name": "xyz"
},
"reviewRating": {
"@type": "Rating",
"bestRating": "5",
"ratingValue": "4",
"worstRating": "1"
}
}
}
AggregateRating
in the Structured Data Testing Tool is recommended, but not required.
If for some reason you have to use AggregateRating
in this project, then you could hardcode the reviewCount
as 1
and set the ratingValue
to the value you're already pulling into reviewRating
. Again though, that defeats the purpose of AggregateRating
.
来源:https://stackoverflow.com/questions/58950083/implement-structured-schema-in-html-website