
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeIn Studio v3, the __experimental_actions property has been replaced with a more robust configuration system. Here's how to achieve the same behavior for singleton documents like site settings:
document.actions in Studio v3In your sanity.config.ts (or .js), use the document.actions configuration to filter which actions appear on documents:
import {defineConfig} from 'sanity'
export default defineConfig({
// ... other config
document: {
// Filter document actions
actions: (prev, context) => {
// For singleton documents like site settings
if (context.schemaType === 'siteSettings') {
// Only allow publish action (equivalent to ["update", "publish"])
return prev.filter(({action}) => action === 'publish')
}
return prev
},
// Prevent creating new documents of this type
newDocumentOptions: (prev, context) => {
return prev.filter(
(template) => template.templateId !== 'siteSettings'
)
}
}
})The v3 approach provides more flexibility and control:
document.actions: Replaces __experimental_actions for filtering which actions (publish, delete, duplicate, etc.) appear on documents. You receive the full list of default actions and can filter or reorder them based on schemaType or other context.
document.newDocumentOptions: Controls what appears in the "Create new document" menu, preventing users from creating multiple instances of singleton documents.
Here's a complete example that properly restricts a singleton document:
// Array of document types that should be singletons
const singletonTypes = ['siteSettings', 'homePage']
export default defineConfig({
// ... other config
document: {
actions: (prev, context) => {
if (singletonTypes.includes(context.schemaType)) {
// Only allow publish action for singletons
return prev.filter(({action}) => action === 'publish')
}
return prev
},
newDocumentOptions: (prev, context) => {
// Remove singletons from "Create new" menu
return prev.filter(
(template) => !singletonTypes.includes(template.templateId)
)
}
}
})The v3 approach gives you access to more context, allowing you to:
context.currentUser)You can also combine this with Structure Builder to create dedicated menu items that always open your singleton documents, making them feel like true settings pages rather than document lists.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store