Schema structure for Sanity and creating specific fields for each page in a mini-site.
Perfect! This is exactly what you need - singleton documents are the ideal solution for your use case.
Since you're building a mini-site where each page has unique, specific fields (not repeating blog-style content), you should create a separate document schema for each page and configure them as singletons. This means each page type will only ever have one instance in your dataset.
Here's how to approach it:
Create a document schema for each page with its specific fields. For example:
// schemas/homePage.js
export default {
name: 'homePage',
title: 'Home Page',
type: 'document',
fields: [
{
name: 'heroTitle',
type: 'string',
title: 'Hero Title'
},
{
name: 'heroImage',
type: 'image',
title: 'Hero Image'
},
// ... other fields specific to home page
]
}
// schemas/aboutPage.js
export default {
name: 'aboutPage',
title: 'About Page',
type: 'document',
fields: [
{
name: 'companyHistory',
type: 'text',
title: 'Company History'
},
// ... other fields specific to about page
]
}Configure them as singletons in your sanity.config.js to prevent creating multiple instances. The singleton document pattern requires three configurations:
- Structure Builder - creates direct links to each page
- Template filtering - removes these from the "New document" menu
- Document actions - removes duplicate/delete actions
The easiest way is to use the sanity-plugin-singleton-tools plugin, which handles all this configuration automatically.
Important: Create one instance of each document in the Studio BEFORE configuring them as singletons. Once configured, the UI to create new instances will be disabled.
This approach gives your client a clean, organized Studio interface where they can click directly into "Home Page", "About Page", etc., and edit the specific fields for each page without any confusion about creating/managing multiple posts.
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.