docs
FAQPage
Add FAQPage structured data to your Sanity-powered site with a single plugin. Surface expandable Q&A rich results directly in Google Search.
About FAQPage
FAQPage schema describes question-and-answer content that is visibly present on the page. It can help search engines and AI answer systems parse concise answers, but rich result display is limited and not guaranteed. Use FAQPage only for genuine FAQ content that users can read on the page.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
mainEntity | array of objects | ✓ | List of Question objects, each with a name (question text) and acceptedAnswer.text (answer text). |
mainEntity[].name | string | ✓ | The full text of the question. |
mainEntity[].acceptedAnswer.text | string | ✓ | The full text of the answer to the question. |
Plugin Registration
sanity.config.ts
import { defineConfig } from "sanity";
import { schemaOrgFAQPagePlugin } from "sanity-plugin-seofields/schema";
export default defineConfig({
// ... your project config
plugins: [
schemaOrgFAQPagePlugin(),
],
});Schema Usage
Add the schemaOrgFAQPage 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: 'schemaOrgFAQPage',
title: 'FAQ Page Schema',
type: 'schemaOrgFAQPage',
}),
],
})GROQ Query
GROQ query
const query = groq`*[_type == "page"][0]{
"faq": schemaOrgFAQPage {
mainEntity[] {
name,
"acceptedAnswer": acceptedAnswer { text }
}
}
}`;Next.js Component
app/layout.tsx
import { FAQPageSchema } from "sanity-plugin-seofields/schema/next";
export default function Layout({ children }: { children: React.ReactNode }) {
// Fetch your FAQ data from Sanity
const faq = await sanityClient.fetch(query);
return (
<html lang="en">
<body>
<FAQPageSchema data={faq.faq} />
{children}
</body>
</html>
);
}JSON-LD Output
Generated JSON-LD
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is sanity-plugin-seofields?",
"acceptedAnswer": {
"@type": "Answer",
"text": "A Sanity plugin that adds SEO and structured data fields to your documents."
}
},
{
"@type": "Question",
"name": "How do I install it?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Run npm install sanity-plugin-seofields and add the plugin to your sanity.config.ts."
}
}
]
}Last updated: May 27, 2026. Tested with: Sanity Studio v3, v4, and v5.
Was this page helpful?