This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
forked from mearashadowfax/ScrewFast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystatic.config.ts
158 lines (157 loc) · 4.49 KB
/
keystatic.config.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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
import { config, fields, collection } from '@keystatic/core';
export default config({
storage: {
kind: 'local',
},
ui: {
brand: {
name: 'CommerceQuest Admin',
// mark: ({ colorScheme }) => {
// let path = colorScheme === 'dark'
// ? '/icon.svg'
// : '/icon.svg';
// return <img src={path} height={24} />
// },
},
},
collections: {
posts: collection({
label: 'Blogs',
slugField: 'title',
path: 'src/content/blog/*',
format: { contentField: 'content' },
schema: {
title: fields.slug({
name: { label: "Title" },
slug: {
label: "SEO-friendly slug",
description: "Don't change the slug once a file is published!",
},
}),
description: fields.text({
label: "Description",
description: "A short description of the post.",
validation: { isRequired: true },
}),
notes: fields.mdx({
label: "Notes",
description: "Internal notes for this post.",
}),
content: fields.text({
label: 'Main content',
// formatting: true,
// dividers: true,
// links: true,
// images: true,
}),
// draft: fields.checkbox({
// label: "Draft",
// description:
// "Set this post as draft to prevent it from being published.",
// }),
authors: fields.array(
fields.relationship({
label: "Post author",
collection: `authors`,
}),
{
label: "Authors",
validation: { length: { min: 1 } },
itemLabel: (props) => props.value || "Please select an author",
},
),
pubDate: fields.date({ label: "Publish Date" }),
updatedDate: fields.date({
label: "Updated Date",
validation: { isRequired: true },
description:
"If you update this post at a later date, put that date here.",
}),
cardImage: fields.image({
label: "Hero Image",
publicPath: "../",
validation: { isRequired: true },
}),
cardImageAlt: fields.text({
label: "Hero Image Alt Text",
description: "Describe the image for screen readers.",
validation: { isRequired: true },
}),
tags: fields.array(fields.text({ label: "Tags" }), {
label: "Tags",
description: "This is NOT case sensitive.",
itemLabel: (props) => props.value,
validation: { length: { min: 1 } },
}),
},
}),
authors: collection({
label: `Authors`,
slugField: "name",
path: `src/content/authors/*/`,
columns: ["name"],
entryLayout: "content",
format: { contentField: "bio" },
schema: {
name: fields.slug({
name: {
label: "Name",
validation: {
isRequired: true,
},
},
slug: {
label: "SEO-friendly slug",
description: "Never change the slug once this file is published!",
},
}),
authorImage: fields.image({
label: "Author avatar",
publicPath: "../",
validation: { isRequired: true },
}),
authorImageAlt: fields.text({
label: "Author avatar alt text",
description: "Describe the image for screen readers.",
validation: { isRequired: true },
}),
role: fields.text({
label: "Role",
description: "Job + Company",
validation: { isRequired: true },
}),
email: fields.text({
label: "The author's email",
description: "This must look something like `you@email.com`",
validation: { isRequired: true },
}),
authorLink: fields.url({
label: "Author Website or Social Media Link",
validation: { isRequired: true },
}),
bio: fields.mdx({
label: "Full Bio",
description: "The author's full bio",
options: {
bold: true,
italic: true,
strikethrough: true,
code: true,
heading: [2, 3, 4],
blockquote: true,
orderedList: true,
unorderedList: true,
table: false,
link: true,
image: {
directory: "src/content/authors/",
publicPath: "../",
},
divider: true,
codeBlock: false,
},
}),
},
})
},
});