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.
Apr 15, 2023, 9:27 AM
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.
Apr 15, 2023, 9:54 AM
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
Apr 15, 2023, 9:54 AM
(And you’re not “locked in” if you change your mind and want to go from the one to the other)
Apr 15, 2023, 9:55 AM
Sounds good User, thanks 🙂
Apr 15, 2023, 7:01 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?