forked from nuotsu/sanitypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.ts
66 lines (65 loc) · 1.17 KB
/
page.ts
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
import { defineField, defineType } from 'sanity'
export default defineType({
name: 'page',
title: 'Page',
type: 'document',
groups: [
{
name: 'content',
},
{
name: 'options',
},
{
name: 'SEO',
},
],
fields: [
defineField({
name: 'title',
type: 'string',
group: 'content',
}),
defineField({
name: 'pageDescription',
type: 'text',
description:
'This description is used when a card is created based upon this page',
rows: 3,
group: 'content',
}),
defineField({
name: 'modules',
type: 'array',
of: [
{ type: 'blog-rollup' },
{ type: 'custom-html' },
{ type: 'faq-list' },
{ type: 'gallery' },
{ type: 'hero' },
{ type: 'hero.postcard' },
{ type: 'logo-list' },
{ type: 'richtext-module' },
{ type: 'stat-list' },
{ type: 'testimonial-list' },
],
group: 'content',
}),
defineField({
name: 'metadata',
type: 'metadata',
group: 'SEO',
}),
],
preview: {
select: {
title: 'title',
slug: 'metadata.slug.current',
media: 'metadata.image',
},
prepare: ({ title, slug }) => ({
title,
subtitle: slug && (slug === 'index' ? '/' : `/${slug}`),
}),
},
})