How to remove a document type from the "New document" dialog in Sanity Studio
Perfect! You can hide the "Site settings" document type from the "New document" dialog using the newDocumentOptions configuration in your Sanity config. This is exactly what you need for singleton documents that should only exist once.
In your sanity.config.ts (or .js) file, add the newDocumentOptions configuration:
import {defineConfig} from 'sanity'
export default defineConfig({
// ... your other config
document: {
newDocumentOptions: (prev, {creationContext}) => {
// Filter out 'siteSettings' from the new document menu
return prev.filter((templateItem) => templateItem.templateId !== 'siteSettings')
},
},
})If your document type has a different ID than the template ID, you can also check the schemaType:
document: {
newDocumentOptions: (prev, {creationContext}) => {
const {schemaType} = creationContext
// Hide from the global "New document" menu
if (schemaType === 'siteSettings') {
return []
}
return prev
},
}This approach is particularly useful for singleton documents (like site settings, global config, etc.) where you only want one instance to exist. The document can still be accessed and edited through the Studio structure - it just won't appear in the "New document" creation dialog, preventing your teammates from accidentally creating duplicates.
You can also combine this with the Structure Builder to provide direct access to your existing site settings document, making it easy to find and edit without cluttering the new document menu.
Show original thread17 replies
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.