docs
Review
Add Review structured data to your Sanity-powered site. Enable star rating snippets and review rich results in Google search.
About Review
Review schema adds individual review data, enabling star snippets in Google results. Marking up reviews with structured data helps search engines display ratings directly in search results, improving click-through rates and user trust.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
reviewRating.ratingValue | number | — | The numeric rating given in the review. |
author.name | string | — | The name of the person who wrote the review. |
reviewBody | string | — | The full text content of the review. |
Plugin Registration
sanity.config.ts
import { defineConfig } from "sanity";
import { schemaOrgReviewPlugin } from "sanity-plugin-seofields/schema";
export default defineConfig({
// ... your project config
plugins: [
schemaOrgReviewPlugin(),
],
});Schema Usage
Add theschemaOrgReview field to any document schema:
schemas/page.ts
import { defineField, defineType } from 'sanity'
export default defineType({
name: 'page',
title: 'Page',
type: 'document',
fields: [
// ... your other fields
defineField({
name: 'schemaOrgReview',
title: 'Review Schema',
type: 'schemaOrgReview',
}),
],
})GROQ Query
GROQ query
const query = groq`*[_type == "review"][0]{
"review": schemaOrgReview {
"reviewRating": reviewRating { ratingValue },
"author": author { name },
reviewBody
}
}`;Next.js Component
app/layout.tsx
import { ReviewSchema } from "sanity-plugin-seofields/react";
export default function Layout({ children }: { children: React.ReactNode }) {
// Fetch your review data from Sanity
const review = await sanityClient.fetch(query);
return (
<html lang="en">
<body>
<ReviewSchema data={review.review} />
{children}
</body>
</html>
);
}JSON-LD Output
Generated JSON-LD
{
"@context": "https://schema.org",
"@type": "Review",
"reviewRating": {
"@type": "Rating",
"ratingValue": 5
},
"author": {
"@type": "Person",
"name": "Jane Doe"
},
"reviewBody": "Excellent product! Highly recommend for anyone looking for quality."
}Was this page helpful?