How to define schema for site settings in Sanity Studio
The error you're seeing happens because you've created a Structure Builder configuration that references a siteSettings schema type, but you haven't actually defined that schema type in your Sanity Studio configuration yet. The Structure Builder is just organizing how documents appear in your Studio interface—it doesn't create the schema itself.
You need to define the siteSettings schema type separately in your sanity.config.js (or .ts) file. Here's how to fix this:
Step 1: Create your schema type
First, create a schema file for your site settings. In your schema folder (typically schemas/ or schemaTypes/), create a file like siteSettings.js:
export default {
name: 'siteSettings',
title: 'Site Settings',
type: 'document',
fields: [
{
name: 'title',
title: 'Site Title',
type: 'string'
},
{
name: 'description',
title: 'Site Description',
type: 'text'
}
// Add whatever fields you need
]
}Step 2: Register it in your sanity.config.js
Then, import and register this schema in your sanity.config.js:
import { defineConfig } from 'sanity'
import { structureTool } from 'sanity/structure' // Note: it's now structureTool, not desk-tool
import siteSettings from './schemas/siteSettings'
export default defineConfig({
// your projectId and dataset
projectId: 'your-project-id',
dataset: 'production',
plugins: [
structureTool({
structure: (S) =>
S.list()
.title('Content')
.items([
S.listItem()
.title('Site Settings')
.child(
S.editor()
.schemaType('siteSettings')
.documentId('siteSettings')
),
S.divider(),
...S.documentTypeListItems()
.filter(listItem => !['siteSettings'].includes(listItem.getId()))
])
})
],
schema: {
types: [siteSettings] // Register your schema here
}
})Important note: The guide you're following uses older syntax (@sanity/desk-tool/structure-builder). In modern Sanity Studio (v3+), this has been renamed to structureTool and the structure configuration is passed directly to the plugin.
Once you've added the schema type to your configuration and restarted your dev server, the "Unknown schema type" error should disappear, and you'll be able to edit your Site Settings document.
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.