-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanity.config.js
78 lines (64 loc) · 2.16 KB
/
sanity.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import {defineConfig} from 'sanity'
import {deskTool} from 'sanity/desk'
import {visionTool} from '@sanity/vision'
import {schemaTypes} from './schemas'
import {colorInput} from '@sanity/color-input'
// import './assets/customOverrides.css' // Only used with the orderable lists plugin
import CustomLogo from './components/customLogo'
// import dotenv from 'dotenv'
// dotenv.config()
export default defineConfig({
name: 'default',
title: 'HP Center',
projectId: 'b61s48g6',
dataset: 'production',
plugins: [
deskTool({
structure: (S, context) => {
console.log(S.documentTypeListItems())
return S.list()
.title('Content')
.items([
S.listItem().title('Homepage').id('homepage').child(
// Instead of rendering a list of documents, we render a single
// document, specifying the `documentId` manually to ensure
// that we're editing the single instance of the document
S.document().schemaType('homepage').documentId('homepage')
),
// List all other types except the 'homepage' type
...S.documentTypeListItems().filter((item) => item.spec.id !== 'homepage'),
])
},
}),
visionTool(),
colorInput(),
],
// document: {
// // prev is the result from previous plugins and thus can be composed
// productionUrl: async (prev, context) => {
// // context includes the client and other details
// const {client, dataset, document} = context
// if (document._type === 'page') {
// // const slug = await client.fetch(
// // `*[_type == 'routeInfo' && post._ref == $postId][0].slug.current`,
// // {postId: document._id}
// // )
// const slug = document.slug.current
// const params = new URLSearchParams()
// params.set('preview', 'true')
// params.set('dataset', dataset)
// console.log(document)
// return `https://127.0.0.1/posts/${slug}?${params}`
// }
// return prev
// },
// },
schema: {
types: schemaTypes,
},
studio: {
components: {
logo: CustomLogo,
},
},
})