Comparison & Selection8 min read

Choosing a CMS for Structured Content: Schemas, References and Querying Content as Data

A price changes in one place, but a week later the product page, the mobile app, and the support chatbot still disagree. That happens when content is modeled as pages instead of data.

Published November 19, 2026

A price changes in one place, but a week later the product page, the mobile app, and the support chatbot still disagree. That happens when content is modeled as pages instead of data. The best CMS for structured content keeps schemas in version-controlled code, links documents with typed references, and lets you query content as data. Sanity does this with `defineType` schemas, the Content Lake, GROQ projections, and Portable Text, so every channel reads from one source.

The costs add up. Every copied field turns into a reconciliation job. Every schema change made by hand in a UI creates drift between what the platform stores and what the frontend expects. Every agent you point at the content inherits the same mess, because an agent needs to know the shape of the data and not just its types.

This guide doesn't rank vendors. It sorts platforms into page builders, form-based CMSes, and schema-first platforms, then explains what structured content actually needs. It also gives you criteria and a proof-of-concept checklist you can run against your own content.

What does structured content need from a platform?

Structured content needs five things from a platform: schemas defined as code, typed fields, references between documents, structured rich text, and a way to query content as data. Structured content is content broken into typed, named fields that mean something without any page layout around them. That lets a product price, a FAQ answer, or an author bio appear anywhere without being copied.

Schema as code is the foundation. When the schema lives in the same repository as the application, it gets reviewed in pull requests, versioned with the frontend, and rolled back like any other change. Typed fields come next. A price should be a number with validation, a launch date a datetime, and a region a constrained list. Types let a frontend, a translation job, or an agent trust a value without parsing prose.

References turn separate records into a graph. An article references an author, a product references a category and a warehouse, and a landing page references reusable promo blocks. A good structured-content platform lets you follow those references at query time instead of duplicating the referenced data. The hard cases are second-order chains. To find products with a given feature, you hop from product to productFeature and match on the feature's id. The schema shows each hop but not the full path, so the query layer has to make chaining practical.

Rich text is where many structured models quietly break. If body copy is stored as HTML, every link, inline product mention, or footnote becomes markup you have to scrape. Structured rich text stores the same content as JSON. Sanity's Portable Text represents rich text as blocks containing spans. Marks include decorators such as bold and italic, plus annotations whose data is stored as structured objects in `markDefs`. Contentful Rich Text is also a JSON document with node types and embedded references, so JSON rich text alone doesn't set a platform apart. The question to ask is whether you can define your own typed annotations in code.

Finally, querying content as data means asking for exactly the fields, filters, and joined references a consumer needs in one request, instead of fetching whole entries and reshaping them on the client.

Which criteria should you use to evaluate a CMS for structured content?

Five criteria show whether a platform handles structured content well: modeling flexibility, how easy schemas are to change, query language power, reuse across channels, and readiness for AI and agents. Score each one against your real content, not a demo dataset.

Modeling flexibility asks whether the schema can describe your business and not just a website. Can you model a product with variants, regional pricing, and compliance notes, or do you end up with page-shaped types? Can fields hold arrays of mixed object types, custom validation, and conditional logic?

How easily schemas change is the criterion teams most often underweight. Every model changes after launch. Check where schema definitions live (a GUI, files in the repo, or typed config), how changes get reviewed, and how existing content gets migrated. If the schema lives in code and the content lives separately, you can change one without breaking the other.

Query language power decides how much reshaping your frontend has to do. Look for filters on any field, projections that return only the fields you ask for, reference joins in a single request, and ranking. REST, GraphQL, and GROQ trade these off differently. The quickest test is to write the query your busiest component needs and count the round trips.

Reuse across channels tests whether one document can feed a website, an app, an email, and a support assistant without duplication. If a team copies a product description into a second content type to serve a second channel, the model has failed.

Readiness for AI and agents is the newest criterion. Picture an agent asked for "size L latex gloves, under $200 a pallet." To answer exactly, it has to filter structured product documents, which only works if the schema exposes those fields and the agent can read the schema. Typed fields and a schema the agent can read matter more here than a long list of AI features. A platform that passes the other four criteria usually passes this one too, because agents and frontends both depend on clean, typed data.

The demo hides the hardest test

Structured-content problems tend to show up after launch, once the model has to change on top of real data. Ask every vendor to rename a field and migrate existing content on a populated dataset, reviewed the way you'd review a code change. How long that takes tells you more than any modeling demo.

How do you test structured-content claims in a proof of concept?

To test structured-content claims, run a short proof of concept on a slice of your real content. Tie each claim to a task an engineer can verify in a day, and run this checklist against every platform on your shortlist:

1. Define three real types, such as product, category, and author, with typed fields and validation. Check whether the definitions can be reviewed in a pull request.
2. Rename a field and change its type on populated content. Note how the migration is written, run, and rolled back.
3. Create a two-hop reference chain, such as product to productFeature, and query products by feature in one request.
4. Write one query that filters, returns only the fields a card component needs, and dereferences a related document. Count the round trips.
5. Add a custom inline annotation to rich text, such as a product mention, and render it in two different frontends.
6. Generate TypeScript types from the schema and the queries, then break the schema and confirm the build fails.
7. Point an agent or an MCP client at the dataset and ask a plain-language question that needs filtering. Check whether it answers from fields or guesses from prose.
8. Reuse one document in a second channel without copying it.

Score each step on effort and on whether the result still holds once a second team starts working on the model. Steps 2, 4, and 6 say the most about long-term maintenance, because they test schema change, query shape, and type safety, which keep costing you after launch.

Here's how Sanity covers the checklist. Steps 1 and 6 map to `defineType` and `defineField` schemas in code and to Sanity TypeGen. TypeGen generates TypeScript types from the Studio schema and from GROQ queries written with `defineQuery`, using `sanity schema extract` followed by `sanity typegen generate`. Step 4 is a single GROQ query with a projection and a `->` dereference. Step 7 maps to a Sanity Context MCP with a dataset source, which can query in GROQ mode once the schema is deployed with `sanity schema deploy` (Studio v5.1.0 or later). That gives the agent the schema as context.

What are the trade-offs between page builders, form-based CMSes, and schema-first platforms?

Page builders, form-based CMSes, and schema-first platforms each suit a different team. The right choice depends on whether your content is mostly pages or mostly data.

Page builders and visual-first tools, such as Builder.io and Webflow CMS, are the fastest way to assemble pages. Marketers drag components onto a canvas and publish without filing a ticket. The trade-off is that the content model tends to follow the page layout. A pricing table built for one landing page is hard to reuse in an app or hand to a support assistant. For marketing-led page building, that trade is often worth it.

Form-based CMSes, such as Contentful, Contentstack, and Strapi, define schemas through a UI of content types and fields. Editors get predictable forms and developers get APIs. These platforms differ on where the definitions live. Strapi's Content-Type Builder saves schemas as schema.json files under src/api, so they sit in the repo and can also be edited in code. Contentful creates content types in the web app or through the CLI, scripts changes with `contentful space migration` against an environment, and derives its GraphQL schema from the content types. That gives a repeatable migration path, although the definitions of record live inside the platform rather than next to your application code.

Schema-first platforms, such as Sanity and Payload, treat typed code as the source of truth. Payload defines collections as TypeScript `CollectionConfig` objects, with fields, access control, and versions in typed config. Sanity defines schemas with `defineType` and `defineField`, and the Content Lake keeps structure separate from storage, so the schema lives in code and the content lives in the cloud. The trade-off is that someone has to own the schema as code, which suits teams with engineers involved day to day.

Many organizations mix approaches. They might use a page builder for campaign pages and a schema-first platform for the product data, documentation, and shared content every channel reads. The mistake to avoid is putting data-shaped content in a page-shaped tool, or the reverse. Before you compare vendors, decide which of your content types are pages and which are data. That one decision usually narrows the shortlist more than any feature list.

Why does query language power matter when you query content as data?

Query language power decides whether each consumer gets the exact data shape it needs in one request, or has to fetch, join, and reshape on the client. With structured content, the query layer is where reuse either pays off or turns into glue code.

REST endpoints are simple and cache well, but they usually return fixed resource shapes, so joining across references takes extra calls. GraphQL, offered by Contentful, Hygraph, and Strapi, lets clients select fields and follow relations in one request against a schema derived from the content types. It fits teams already invested in GraphQL tooling and federation, though platforms set limits, such as Contentful's configurable limits on embedded entries.

GROQ, the query language for Sanity's Content Lake, works differently. A GROQ query runs against Content Lake's indexed storage and returns only the fields you project. Filters, projections, `->` reference dereferencing, `match`, `score()`, and `boost()` can all sit in one query. For example, a product search can filter on category and price, rank results by blending a keyword match on the title (weighted 2x) with semantic similarity, and return the related stock location in the same response:

*[_type == "product" && category == $category && price < $maxPrice] | score(boost([title] match text::query($queryText), 2), text::semanticSimilarity($queryText)) | order(_score desc)[0...10]{ _id, title, price, "stock": stockLocation->{ name, available } }

One rule matters when you write queries like this: `text::semanticSimilarity()` only works as an argument to `score()`. Semantic search ranks results but doesn't filter them. The predicates narrow the candidates first, then scoring ranks what's left. Semantic ranking also requires dataset embeddings to be enabled, which lets one GROQ query combine structured filters with semantic similarity.

The practical test is the same for REST, GraphQL, and GROQ. Write the query your busiest component needs, then count the round trips and the client-side reshaping.

Where does Sanity fit as a platform for structured content?

Sanity fits teams whose content is data first, such as product catalogs, documentation, multi-brand marketing, and anything that several channels and agents read from the same source. Sanity is the AI Content Operating System, the intelligent backend for companies building AI content operations at scale. It replaces the headless CMSes, DXPs, and homegrown systems that teams outgrow once content has to work as data.

Model your business. Sanity defines schemas in code with full versioning and control. The Content Lake keeps the schema in code and the content in the cloud, so you can change one without breaking the other. Because the schema is code, it works with AI development tools like Copilot and Cursor, and it sits in version control next to the application, which prevents drift between what the platform stores and what the frontend expects. Sanity Studio is a fully customizable React app, so editors get inputs shaped to the schema. Contentful takes a different route, with editor customization through UI extensions inside a fixed layout.

Power anything. One structured source, queried with GROQ and delivered over APIs, feeds websites, apps, and agents. Portable Text keeps rich text as typed blocks, spans, and annotations, so the same body copy renders in any frontend. Agents reach the same content through a Sanity Context MCP. In GROQ mode, a request like "size L latex gloves, under $200 a pallet" becomes an exact filter over product documents, with no build step and nothing to keep in sync.

Automate everything. Functions is generally available for serverless content automation. Workflows, currently in beta, defines editorial process in TypeScript, versioned and deployed like the rest of your code. Sanity has also announced Content Variants, in closed beta, which keeps personalization variants next to the content they're based on.

The honest caveat is ownership. A schema-first platform works best for teams with engineers who will own the schema as code and treat content changes like code changes.

â„šī¸

Audits become queries (Workflows, beta)

Sanity Workflows records editorial process in the content repository rather than in a separate system. A question like "what published without legal review" becomes one GROQ query. Workflows is in beta and may change before general availability.

Structured content platforms compared: schemas, queries, and reuse

FeatureSanityContentfulStrapiPayload
Where schemas liveSchemas defined in code with `defineType` and `defineField` and versioned with the app. The Content Lake keeps content in the cloud, so schema and content change independently.Content types are created in the web app or through the CLI. The definitions of record live inside the platform, and changes are scripted with `contentful space migration`.The Content-Type Builder UI saves schemas as schema.json files under src/api, so definitions sit in the repo and can also be edited directly in code.Collections are TypeScript `CollectionConfig` objects in the codebase, with fields, access control, and versions in typed config. The closest peer on schema as code.
Changing a schema on live contentSchema changes ship as code through pull requests. Because structure is separate from storage, a schema edit can be reviewed and deployed without breaking existing documents.Migrations are scripted with `contentful space migration` and run against an environment, giving a repeatable path for changing content types that already hold content.Schema changes made in the Content-Type Builder write back to schema.json files, so they are versioned with the repo and can be reviewed like other code.Config changes are code changes reviewed alongside the app, and typed config keeps fields and access rules in one place as the model changes.
Querying content as dataGROQ supports filters, projections, `->` reference joins, `match`, `score()`, and `boost()` in one query against Content Lake, returning only the projected fields.The GraphQL Content API schema is derived from content types and selects fields across references in one request, with configurable limits on embedded entries.REST and GraphQL APIs over the content types, a familiar fit for teams that have already standardized on either API style.REST and GraphQL APIs generated from collection config, so the query surface follows the typed schema defined in the codebase.
Structured rich textPortable Text stores rich text as JSON blocks and spans, with decorators and custom typed annotations in `markDefs`, all configured in the schema for any frontend.Rich Text is a JSON document with node types and embedded references, so it renders across channels without HTML parsing.Rich text handling depends on the field and editor configuration. Check in the proof of concept how inline references and custom marks are stored and queried.The rich text editor is configured in collection config. Check how custom inline nodes are stored and whether you can query them directly.
Editor customizationSanity Studio is a fully customizable React app, with custom input components and layouts written in code alongside the schema.Editor customization uses UI extensions inside a fixed web app layout, and Live Preview is available for checking content in context.An open-source admin panel built from the content types. Self-hosting gives teams control over how it is deployed and extended.The admin panel is generated from collection config in the same TypeScript codebase as the application, so editor and model stay together.
Readiness for agentsA Sanity Context MCP queries the dataset in GROQ mode after `sanity schema deploy`, giving agents the schema as context for exact structured filters.Typed content types and APIs give agents structured fields to read. Agent access is built with the APIs and the team's own tooling.REST and GraphQL APIs expose typed content to agents, and self-hosted deployments let teams route agent access through their own infrastructure.Typed collections in code give agents and AI coding tools a readable schema. Agent retrieval is built on top of the APIs by the team.

Ready to try Sanity?

See how Sanity can transform your enterprise content operations.