Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

any hints on creating a group of singletons in structure builder?

3 replies
Last updated: Jan 14, 2021

any hints on creating a group of singletons in structure builder?

Jan 14, 2021, 2:24 AM

i usually do something like this..

S.listItem()
        .title('Pages')
        .icon(Pages)
        .child(S.list().title('Pages').items(pages)),
and then make an array of all of your singleton (in this case page) types..

[S.documentListItem().schemaType('aboutPage').id('aboutPage'), ...]

Jan 14, 2021, 2:58 AM

awesome, thanks for the tip!

Jan 14, 2021, 3:04 AM

of course!

Jan 14, 2021, 3:04 AM

Sanity.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. Sanity.io comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Sanity.io. Free to get started, pay-as-you-go on all plans.