Can a single model in Sanity.io have different types of content?

4 replies
Last updated: Apr 15, 2023
Is it possible to have a single model, such as "Pages" and when you create a new content with that model you can choose from different types? I.e. "Basic" / "Page builder" where basic is a simpler just text based content and page builder more advanced and customizable.
You can make this work by adding a property
pageType
(or whatever) and use Initial Value Templates + Conditional Fields that relies on the
pageType
property.
Then the editor can choose to make one of these templates and the
pageType
will be pre-filled and the relevant fields will be displayed
(And you’re not “locked in” if you change your mind and want to go from the one to the other)
Sounds good User, thanks 🙂

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?