Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Removing a document type from the "New document" dialog in Sanity Studio

17 replies
Last updated: Dec 19, 2022
Hi ! I can’t find a way to remove a documentId from the “New document” dialog in the studio. I want to block my teammates from creating a new “Site settings” document .. Could you help me ? 🙂
Dec 18, 2022, 7:46 PM
deskTool({ name: 'content',
title: 'Content',
structure: (S) =>
S.list()
.title('Content')
.items([
S.documentTypeListItem('tools'),
S.documentTypeListItem('collections'),
S.divider(),
S.listItem()
.icon(MdInfo)
.title('About')
.child(S.editor().schemaType('about').documentId('about')),
S.divider(),
S.documentTypeListItem('categories'),
S.documentTypeListItem('tags'),
]),
}),
Dec 18, 2022, 8:35 PM
This can be done in your deskTool! The «About» list item is the way ive done it
Dec 18, 2022, 8:36 PM
Are you sure it’s going to remove the document type from the “New document” dialog in the top left corner of the studio ?
Dec 18, 2022, 8:36 PM
Can you take a screenshot?
Dec 18, 2022, 8:40 PM
Sure I want to remove it from here
Dec 18, 2022, 8:42 PM
Can’t recall to see a icon there on a single page!
Dec 18, 2022, 8:43 PM
But give it a try
Dec 18, 2022, 8:43 PM
S.listItem() .icon(MdInfo)
.title('About')
.child(S.editor().schemaType('about').documentId('about')),
Dec 18, 2022, 8:44 PM
This is what you need
Dec 18, 2022, 8:44 PM
Let me try
Dec 18, 2022, 8:46 PM
I did it it’s not changing anything .. 😕
Dec 18, 2022, 8:47 PM
:/ Well currently not on a computer, but there is probably some people that can help! Monday tomorrow so Sanity people is back :saluting_face:
Dec 18, 2022, 8:52 PM
In the sanity.config.json

document: {
    newDocumentOptions: (prev, { creationContext }) => {
      if (creationContext.type === 'global') {
        return prev.filter((templateItem) => templateItem.templateId != 'settings')
      }
      return prev
    },
    actions: (prev, { schemaType }) => {
      if (schemaType === 'settings') {
        return prev.filter(({ action }) => !['unpublish', 'delete','duplicate'].includes(action))
      }
      return prev
    },
  }
Dec 19, 2022, 12:51 AM
Thanks for your help, I’ll try it !
Dec 19, 2022, 9:21 AM
Works perfectly. It was quite hidden in the docs to be honest
Dec 19, 2022, 9:25 AM
Yeah I know, found it by chance as well haha
Dec 19, 2022, 2:56 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?