-
Notifications
You must be signed in to change notification settings - Fork 3
/
_cms.ts
54 lines (50 loc) · 1.08 KB
/
_cms.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
import site from '#data/site.ts'
import lumeCMS from 'lume/cms/mod.ts'
const cms = lumeCMS({
site,
})
cms.collection({
name: 'posts',
description: 'Create, edit or delete the posts of the blog',
store: 'src:posts/*.md',
fields: [{
name: 'title',
type: 'text',
label: 'Title of the page',
attributes: {
required: true,
maxlength: 100,
},
}, {
name: 'excerpt',
type: 'text',
label: 'Description displayed in post overview',
attributes: {
required: true,
maxlength: 200,
},
}, {
name: 'date',
type: 'date',
label: 'Published date',
}, {
name: 'draft',
label: 'Draft',
type: 'checkbox',
description: 'If checked, the post will not be published.',
}, {
name: 'tags',
type: 'list',
label: 'Tags',
init(field) {
const { data } = field.cmsContent
field.options = data.site?.search.values('tags')
},
}, {
name: 'content',
type: 'markdown',
label: 'Page content',
}],
})
cms.upload('uploads: Uploaded files', 'src:assets/images/blog')
export default cms