Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong schema output #23

Open
NormanHoehne opened this issue Jul 12, 2024 · 0 comments
Open

Wrong schema output #23

NormanHoehne opened this issue Jul 12, 2024 · 0 comments

Comments

@NormanHoehne
Copy link

NormanHoehne commented Jul 12, 2024

There is a misconsepction about the calculation of the aggregateRating

On this line:

$total = $total + absint( $review['reviewRating']['ratingValue'] );

you sum up every ratingValue from every testimonial displayed.

The documentation of AggregateRating says:

  • the property of aggregateRating.ratingValue just should be "The rating for the content."
  • the property of aggregateRating.bestRating just should be "The highest value allowed in this rating system."

Since every testimonial outpouts a ratingValue of 5, your schema should always output

"aggregateRating": {
	"@type": "AggregateRating",
	"ratingValue": 5,
	"bestRating": 5,
	"ratingCount": 99
},

no matter how many ratings are counted. So there is no calculation of ratingValue or bestRating necessary at all.

I'd also suggest to add the property bestRating to the review.reviewRating schema as well so that it looks like this:

"review": [{
	"@type": "Review",
	"reviewRating": {
		"@type": "Rating",
		"ratingValue": "5"
		"bestRating": "5"
	},
	"author": {
		"@type": "Person",
		"name": "John Doe"
	},
	"reviewBody": "..."
}]

By the way: It would be better to give the user a choice if he wants to display the schema. Or at least an information that you do output schema would be nice. And if you force to output the schema, please make sure that it is correct.
Thank's for apply filters so that I can remove it myself as a developer. 😊 ♥️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant