Sanity desk structure missing "Create new" button for custom document type
Looking at your code, I can see you're using Sanity Studio v2 syntax (the @sanity/desk-tool/structure-builder import), which reached end-of-life on December 7, 2023. The missing "Create new" button is likely happening because of how v2's desk structure works - when you explicitly define a custom structure, you need to ensure the document type is properly configured.
However, before diving into a v2-specific fix, I'd strongly recommend upgrading to Studio v3, since v2 is no longer supported and won't receive security updates or bug fixes.
Quick Fix for v2 (if you must stay on v2 temporarily)
The issue in your current v2 setup is that when using .child(S.documentTypeList("page")), you need to make sure the create button is enabled. Try this modification:
S.listItem()
.title("Pages")
.icon(IoDocumentTextOutline)
.schemaType("page")
.child(
S.documentTypeList("page")
.title("Pages")
.canHandleIntent(S.documentTypeList.canHandleIntent)
),Also, double-check that your page document type doesn't have any configuration that might be hiding it from creation menus.
Better Solution: Migrate to Studio v3
Since Studio v2 support ended in December 2023, I'd recommend migrating to v3 where this pattern works more reliably. In v3, the structure configuration looks like this:
// structure/index.ts
import type {StructureResolver} from 'sanity/structure'
import {IoDocumentTextOutline, IoFastFoodOutline, IoTicketOutline, IoPersonOutline, IoSettingsOutline} from 'react-icons/io5'
export const structure: StructureResolver = (S) =>
S.list()
.title("Sadržaj")
.items([
S.documentTypeListItem("page")
.title("Pages")
.icon(IoDocumentTextOutline),
S.documentTypeListItem("recept")
.title("Recepti")
.icon(IoFastFoodOutline),
S.documentTypeListItem("category")
.title("Kategorije")
.icon(IoTicketOutline),
S.documentTypeListItem("autor")
.title("Autori")
.icon(IoPersonOutline),
S.divider(),
S.listItem()
.title("Postavke")
.icon(IoSettingsOutline)
.child(
S.editor().schemaType("siteSettings").documentId("siteSettings")
),
...S.documentTypeListItems().filter(
(listItem) =>
!["autor", "recept", "category", "siteSettings", "page"].includes(
listItem.getId()
)
),
])Then in your sanity.config.ts:
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {structure} from './structure'
export default defineConfig({
// ... your other config
plugins: [
structureTool({structure}),
// ... other plugins
],
})Notice in v3, the Structure Builder uses S.documentTypeListItem() as a convenience method - it automatically handles the create button, menu items, and initial value templates for you. This is cleaner and more reliable than the v2 pattern you're using with .listItem().child(S.documentTypeList()).
The migration guide will help you through the upgrade process. The main changes are moving from sanity.json to sanity.config.ts and updating import paths, but it's worth it for ongoing support and better functionality!
Show original thread3 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.