-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.js
81 lines (78 loc) · 1.76 KB
/
schema.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
79
80
81
// First, we must import the schema creator
import createSchema from 'part:@sanity/base/schema-creator'
// Then import schema types from any plugins that might expose them
import schemaTypes from 'all:part:@sanity/base/schema-type'
// Then we give our schema to the builder and provide the result to Sanity
export default createSchema({
// We name our schema
name: 'default',
// Then proceed to concatenate our document type
// to the ones provided by any plugins that are installed
types: schemaTypes.concat([
/* Your types here! */
{
name: 'post',
type: 'document',
title: 'Post',
fields: [
{
name: 'title',
title: 'Title',
type: 'string',
},
{
name: 'slug',
title: 'Slug',
type: 'slug',
options: {
source: 'title',
},
},
{
name: 'content',
title: 'Content',
type: 'array',
of: [{ type: 'block' }],
},
{
name: 'excerpt',
title: 'Excerpt',
type: 'string',
},
{
name: 'coverImage',
title: 'Cover Image',
type: 'image',
},
{
name: 'date',
title: 'Date',
type: 'datetime',
},
{
name: 'author',
title: 'Author',
type: 'reference',
to: [{ type: 'author' }],
},
],
},
{
name: 'author',
type: 'document',
title: 'Author',
fields: [
{
name: 'name',
title: 'Name',
type: 'string',
},
{
name: 'picture',
title: 'Picture',
type: 'image',
},
],
},
]),
})