Override document heading logic for documents without title field
Yes, you can absolutely override the document heading logic! For one-off documents like a homepage where you don't want a user-editable title field, you can use the __experimental_formPreviewTitle property in your schema.
Here's how to hide the form preview title for singleton documents:
export const homepage = {
name: 'homepage',
title: 'Homepage',
type: 'document',
__experimental_formPreviewTitle: false,
fields: [
// your fields here, no title field needed
],
}Setting __experimental_formPreviewTitle: false will remove the large document heading that appears at the top of the form in Sanity Studio (available since v3.24.1).
Alternative approach using preview configuration:
If you want more control over what displays in lists and references (while still hiding the form title), you can combine both approaches:
export const homepage = {
name: 'homepage',
title: 'Homepage',
type: 'document',
__experimental_formPreviewTitle: false,
fields: [
// your fields without a title
],
preview: {
prepare() {
return {
title: 'Homepage', // Fixed title for list views
}
}
}
}This gives you a static "Homepage" title in document lists and references, while removing the redundant heading from the document form itself. This is particularly useful for singleton documents where the title is always the same and doesn't need to be editable.
The __experimental_ prefix indicates this is still an experimental feature, but it's been stable and widely used since its introduction. You can read more about preview configuration in the Sanity documentation.
Show original thread6 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.