-
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathkeystatic.config.ts
More file actions
94 lines (90 loc) · 2.75 KB
/
keystatic.config.ts
File metadata and controls
94 lines (90 loc) · 2.75 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
import { config, fields, collection } from '@keystatic/core';
// https://keystatic.com/docs/local-mode
// Set storage mode: "local" or "github"
let KEYSTATIC_STORAGE_MODE = 'local';
// GitHub repository details (required for GitHub mode)
const GITHUB_REPO_OWNER = 'REPO_OWNER';
const GITHUB_REPO_NAME = 'REPO_NAME';
export default config({
storage:
(KEYSTATIC_STORAGE_MODE as 'github') === 'github'
? {
kind: 'github',
repo: `${GITHUB_REPO_OWNER}/${GITHUB_REPO_NAME}`,
}
: {
kind: 'local',
},
collections: {
articles: collection({
label: 'Articles',
slugField: 'title',
path: 'src/content/articles/*',
format: { contentField: 'content' },
schema: {
title: fields.slug({ name: { label: 'Title' } }),
description: fields.text({ label: 'Description' }),
content: fields.markdoc({
label: 'Content',
options: {
image: {
directory: 'src/assets/images/articles',
publicPath: '@images/articles/',
},
},
}),
date: fields.date({
label: 'Publication date',
description: 'The date of the publication',
}),
},
}),
reference: collection({
label: 'Reference',
slugField: 'title',
path: 'src/content/reference/*',
format: { contentField: 'content' },
schema: {
title: fields.slug({ name: { label: 'Title' } }),
description: fields.text({ label: 'Description' }),
content: fields.markdoc({
label: 'Content',
options: {
image: {
directory: 'src/assets/images/reference',
publicPath: '@images/reference/',
},
},
}),
date: fields.date({
label: 'Publication date',
description: 'The date of the publication',
}),
},
}),
spreadsheets: collection({
label: 'Sample Spreadsheets',
slugField: 'title',
path: 'src/data/spreadsheets/*',
format: { data: 'json' },
schema: {
title: fields.slug({ name: { label: 'Spreadsheet Name' } }),
description: fields.text({ label: 'Description' }),
url: fields.url({ label: 'Link' }),
},
}),
whitepapers: collection({
label: 'Whitepapers',
slugField: 'title',
path: 'src/data/whitepapers/*',
format: { data: 'json' },
schema: {
title: fields.slug({ name: { label: 'Whitepaper Name' } }),
description: fields.text({ label: 'Description' }),
readLink: fields.url({ label: 'Read Link' }),
btnTitle: fields.text({ label: 'Button Title' }),
btnLink: fields.url({ label: 'Button Link' }),
},
}),
},
});