Skip to main content
seofields

Feature

Schema.org JSON-LD fields for Sanity Studio

Model structured data in Sanity instead of hardcoding JSON-LD by hand. The plugin ships 39 Schema.org types, Studio schemas, live JSON-LD previews, React components, and builder functions.

Short answer: sanity-plugin-seofields ships 39 Schema.org types as Sanity Studio fields, with a live JSON-LD preview and React components that render valid JSON-LD from your frontend.

Last updated

Why model Schema.org structured data in Sanity

39 built-in types

Cover common structured data needs including Article, Product, Organization, FAQPage, LocalBusiness, Event, Course, Recipe, and more.

Editor-owned structured data

Give content teams typed fields for rich result data instead of asking them to edit raw JSON.

Render with components or builders

Use React components in Next.js or JSON-LD builder functions in custom frontend code.

From Sanity fields to JSON-LD on the page

1

Register schemaOrg()

Add the schemaOrg plugin to Sanity config so the structured data object types are available.

2

Pick a Schema.org type

Add the relevant structured data field to pages, posts, products, organizations, or location documents.

3

Render JSON-LD

Query the field and render a script tag with SchemaOrgScripts, individual components, or build functions.

Schema.org JSON-LD code examples

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(),
    schemaOrg(),
  ],
})
Render Article JSON-LD in Next.js
import { ArticleSchema } from 'sanity-plugin-seofields/next/article'

export default async function ArticlePage() {
  const article = await getArticle()

  return (
    <>
      <ArticleSchema data={article.schemaOrgArticle} />
      <main>{/* page content */}</main>
    </>
  )
}
Build JSON-LD for any renderer
import { buildArticleJsonLd } from 'sanity-plugin-seofields/next/article'

const jsonLd = buildArticleJsonLd(article.schemaOrgArticle)

const script = JSON.stringify(jsonLd)

Schema.org in Sanity FAQ

How many Schema.org types are included?

The plugin includes 39 structured data types with Sanity schema definitions and frontend rendering helpers.

Can I inspect the JSON-LD before publishing?

Yes. The Schema.org docs and Studio fields are designed around visible structured data, with previews that make the generated JSON-LD easier to review.

Do Schema.org helpers only work with Next.js?

The React components are useful in Next.js and React apps. Builder functions return JSON-LD objects that can be serialized in custom frontends.

Can I use several schema types on one page?

Yes. Use the combined SchemaOrgScripts helper or render multiple individual JSON-LD script blocks when a page needs multiple entities.

Add structured data without raw JSON editing

Start with the Schema.org overview, then choose the types that match your content model.