Skip to content

Instantly share code, notes, and snippets.

@cupofcrazy
Created October 4, 2024 01:58
Show Gist options
  • Select an option

  • Save cupofcrazy/a9bdd610db626cec7e55013f107658fe to your computer and use it in GitHub Desktop.

Select an option

Save cupofcrazy/a9bdd610db626cec7e55013f107658fe to your computer and use it in GitHub Desktop.
Sanity Structure Template
import { type StructureBuilder } from "sanity/structure";
export const structure = (S: StructureBuilder) => {
return S.list()
.title("Content")
.items([
S.listItem()
.title("Home")
.icon(INSERT_ICON_HERE)
.child(
S.document()
.schemaType(HOME_DOCUMENT_ID)
.title("Home")
),
S.divider(),
...S.documentTypeListItems()
.filter(type => ![HOME_DOCUMENT_ID].includes(type.getId() as string)),
S.divider(),
S.listItem()
.title("Archive")
.icon(FolderArchiveIcon)
.child(
S.document()
.schemaType("archive")
.title("Archive")
),
S.listItem()
.title("Info")
.icon(InfoIcon)
.child(
S.document()
.schemaType("info")
.title("Info")
),
])
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment