Skip to main content
seofields
docs
.md

Schema.org Structured Data

Add structured Schema.org data to Sanity content with typed Studio fields, React JSON-LD components, and framework-neutral builders. Use Article, Product, FAQPage, WebSite, Organization, BreadcrumbList, and 30+ more types to describe content clearly for rich results, knowledge graphs, and AI answer surfaces.

Why Schema.org matters in the AI era

Schema.org structured data gives search engines and AI answer systems clearer entity, relationship, and page-type signals. It does not guarantee rankings or AI citations, but it makes your content easier to parse, validate, and reference when the visible page content matches the markup.

Live JSON-LD Preview in Studio

Schema.org object fields and the combined schemaOrg array show a live JSON-LD preview below the editor. The preview uses the same builders as the frontend renderer, and can resolve a page URL from the current document slug.

Quick Start

Register all 39 types at once with the combined plugin:

sanity.config.ts
import { defineConfig } from 'sanity'
import seofields from 'sanity-plugin-seofields'
import { schemaOrg } from 'sanity-plugin-seofields/schema'

export default defineConfig({
  // ...
  plugins: [
    seofields(),    // SEO fields + dashboard
    schemaOrg(),    // all 39 Schema.org types
  ],
})

Customize the resolved preview URL or disable the Studio preview:

JSON-LD preview config
schemaOrg({
  jsonLdPreview: {
    baseUrl: 'https://example.com',
    slugField: 'slug',
    pathPrefix: (doc) => doc._type === 'post' ? 'blog' : '',
  },
  article: {
    jsonLdPreview: false, // disable for one individual type
  },
})

Individual Plugins

Or register only the types you need:

sanity.config.ts — individual
import { defineConfig } from 'sanity'
import {
  schemaOrgWebsitePlugin,
  schemaOrgOrganizationPlugin,
  schemaOrgArticlePlugin,
  schemaOrgFAQPagePlugin,
} from 'sanity-plugin-seofields/schema'

export default defineConfig({
  // ...
  plugins: [
    schemaOrgWebsitePlugin(),
    schemaOrgOrganizationPlugin(),
    schemaOrgArticlePlugin(),
    schemaOrgFAQPagePlugin(),
  ],
})

Schema Usage

When using schemaOrg(), a combined schemaOrg array field is registered that can hold multiple Schema.org types. Add it 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: 'schemaOrg',
      title: 'Schema.org Structured Data',
      type: 'schemaOrg',
    }),
  ],
})

Or use individual types directly:

Individual fields
defineField({
  name: 'schemaOrgWebsite',
  title: 'Website Schema',
  type: 'schemaOrgWebsite',
}),
defineField({
  name: 'schemaOrgOrganization',
  title: 'Organization Schema',
  type: 'schemaOrgOrganization',
}),

Rendering in Next.js

Each type has a React component that renders a valid <script type="application/ld+json"> tag:

app/layout.tsx
import {
  WebsiteSchema,
  OrganizationSchema,
  ArticleSchema,
} from 'sanity-plugin-seofields/schema/next'

export default function Layout({ data }) {
  return (
    <>
      <WebsiteSchema data={data.website} />
      <OrganizationSchema data={data.organization} />
      <ArticleSchema data={data.article} />
      {/* ... */}
    </>
  )
}

Combined Schema Array

When using schemaOrg(), a schemaOrg array field is registered that can hold multiple types. Render all of them with one component:

Combined renderer
import { SchemaOrgScripts } from 'sanity-plugin-seofields/schema/next'

// In your page component
<SchemaOrgScripts data={data.schemaOrg} />

Document Node JSON-LD Preview

Use the exported document preview component in a Structure view to show the generated JSON-LD, the resolved slug URL, and existing slugs for the current document type.

sanity.config.ts — document view
import { structureTool } from 'sanity/structure'
import { SchemaOrgDocumentJsonLdPreview } from 'sanity-plugin-seofields/schema'

structureTool({
  defaultDocumentNode: (S) =>
    S.document().views([
      S.view.form(),
      S.view
        .component((props) => (
          <SchemaOrgDocumentJsonLdPreview
            {...props}
            baseUrl="https://example.com"
            schemaOrgField="schemaOrg"
            slugField="slug"
            pathPrefix={(doc) => doc._type === 'post' ? 'blog' : ''}
          />
        ))
        .title('JSON-LD'),
    ]),
})

All 39 Schema.org Types

Grouped by purpose. Click any type for fields, JSON-LD output, and usage examples.

Try the type picker →

Content & Articles

11 types

Pages, editorial, and written content.

Commerce & Offers

8 types

Products, pricing, ratings, and reviews.

Organization & Place

12 types

People, businesses, locations, and events.

Media & More

8 types

Images, video, music, navigation, and education.

Import Paths

sanity-plugin-seofields/schema

Sanity Studio plugins, schema factories, data types, and generator utilities.

sanity-plugin-seofields/schema/next

React components that render <script type="application/ld+json"> tags.

sanity-plugin-seofields/next

All Schema.org React components + Next.js/React SEO meta helpers.

Was this page helpful?