62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
import { defineConfig } from 'sanity'
|
||
import { deskTool, type StructureBuilder } from 'sanity/desk'
|
||
import { visionTool } from '@sanity/vision'
|
||
import { codeInput } from '@sanity/code-input'
|
||
import { schemaTypes } from './sanity/schemas'
|
||
|
||
const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!
|
||
const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET || 'production'
|
||
|
||
export default defineConfig({
|
||
name: 'so-imit-blog',
|
||
title: 'СО ИМИТ ВолГУ - Блог',
|
||
|
||
projectId,
|
||
dataset,
|
||
|
||
plugins: [
|
||
deskTool({
|
||
structure: (S: StructureBuilder) =>
|
||
S.list()
|
||
.title('Контент')
|
||
.items([
|
||
S.listItem()
|
||
.title('Посты')
|
||
.icon(() => '📝')
|
||
.child(S.documentTypeList('post').title('Посты')),
|
||
S.listItem()
|
||
.title('События')
|
||
.icon(() => '📅')
|
||
.child(S.documentTypeList('event').title('События')),
|
||
S.divider(),
|
||
S.listItem()
|
||
.title('Авторы')
|
||
.icon(() => '👤')
|
||
.child(S.documentTypeList('author').title('Авторы')),
|
||
S.listItem()
|
||
.title('Категории')
|
||
.icon(() => '📁')
|
||
.child(S.documentTypeList('category').title('Категории')),
|
||
]),
|
||
}),
|
||
visionTool(),
|
||
codeInput(),
|
||
],
|
||
|
||
schema: {
|
||
types: schemaTypes,
|
||
},
|
||
|
||
document: {
|
||
newDocumentOptions: (prev, { creationContext }) => {
|
||
// Filter out certain document types from the "Create new" menu
|
||
if (creationContext.type === 'global') {
|
||
return prev.filter(
|
||
(template) => !['author', 'category'].includes(template.templateId)
|
||
)
|
||
}
|
||
return prev
|
||
},
|
||
},
|
||
})
|