-
Notifications
You must be signed in to change notification settings - Fork 0
/
keystatic.config.tsx
60 lines (58 loc) · 1.38 KB
/
keystatic.config.tsx
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
import {
collection,
component,
config,
fields,
LocalConfig,
GitHubConfig,
} from "@keystatic/core";
const storage: LocalConfig["storage"] | GitHubConfig["storage"] =
process.env.NODE_ENV === "development"
? { kind: "local" }
: {
kind: "github",
repo: {
owner: process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER!,
name: process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG!,
},
};
export default config({
storage,
collections: {
posts: collection({
label: "Posts",
path: "content/posts/*/",
slugField: "slug",
schema: {
title: fields.text({ label: "Title" }),
slug: fields.text({
label: "Slug",
validation: { length: { min: 4 } },
}),
content: fields.document({
label: "Content",
formatting: true,
dividers: true,
links: true,
layouts: [
[1, 1],
[1, 1, 1],
[2, 1],
[1, 2, 1],
],
componentBlocks: {
something: component({
label: "Some Component",
preview: () => null,
schema: {},
}),
},
}),
authors: fields.array(fields.text({ label: "Name" }), {
label: "Authors",
itemLabel: (props) => props.value,
}),
},
}),
},
});