✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Limiting certain content modules to one per array in a Sanity.io project.

4 replies
Last updated: Jul 29, 2020
i have an array of different content modules that make up the pages of a website. most of the modules can be repeated freely throughout a page, but there are a few modules that i'd like to limit to 1 per array. assuming this would be done using
custom
validation? has anyone done this?
Jul 29, 2020, 5:57 PM
not very sure about this but I think
__experimental_actions: [/*'create',*/ 'update', /*'delete',*/ 'publish']
can be a solution. This limits the document or object to be updated and published but not created or deleted. I believe it removes the create and delete buttons
Jul 29, 2020, 6:28 PM
this is usually used with siteSettings which is usually used once through out the site
Jul 29, 2020, 6:29 PM
this isn't quite what im looking for
Jul 29, 2020, 6:35 PM
i think i solved the problem thank you!
Jul 29, 2020, 6:35 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?