-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathkeystatic.config.tsx
More file actions
150 lines (146 loc) · 3.9 KB
/
keystatic.config.tsx
File metadata and controls
150 lines (146 loc) · 3.9 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
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
import { config, fields, collection } from "@keystatic/core";
import { inline } from "@keystatic/core/content-components";
const knownAuthors = [
"Thomas Wouters",
"Hugo van Kemenade",
"Pablo Galindo",
"Łukasz Langa",
"Ned Deily",
"Larry Hastings",
"Benjamin Peterson",
"Brian Curtin",
"Ee Durbin",
"Paul Moore",
"A.M. Kuchling",
"Sumana Harihareswara",
"Doug Hellmann",
"Georg Brandl",
"Antoine P.",
"Davidmh",
"haypo",
"Mathieu Leduc-Hamel",
"Michael Markert",
"Mike Driscoll",
"Philip Jenvey",
];
const knownTags = [
"releases",
"pypi",
"pip",
"3",
"platforms",
"mercurial",
"ironpython",
"docs",
"contributors",
"buildbot",
];
const referenceComponents = {
Pep: inline({
label: "PEP Reference",
schema: {
number: fields.integer({
label: "PEP Number",
validation: { isRequired: true, min: 0 },
}),
},
}),
Docs: inline({
label: "Python Docs",
schema: {
path: fields.text({
label: "Path (e.g. 3/library/asyncio.html)",
validation: { isRequired: true },
}),
label: fields.text({ label: "Display Label" }),
},
}),
PyPi: inline({
label: "PyPI Package",
schema: {
name: fields.text({
label: "Package Name",
validation: { isRequired: true },
}),
},
}),
GhRepo: inline({
label: "GitHub Repo",
schema: {
repo: fields.text({
label: "owner/repo",
validation: { isRequired: true },
}),
},
}),
GhUser: inline({
label: "GitHub User",
schema: {
name: fields.text({
label: "Username",
validation: { isRequired: true },
}),
},
}),
};
export default config({
storage:
process.env.NODE_ENV === "development"
? { kind: "local" }
: {
kind: "github",
repo: { owner: "JacobCoffee", name: "python-insider-blog" },
branchPrefix: "keystatic/",
},
collections: {
authors: collection({
label: "Authors",
slugField: "name",
path: "content/authors/*",
format: "json",
columns: ["name", "featured"],
schema: {
name: fields.text({ label: "Name", validation: { isRequired: true } }),
bio: fields.text({ label: "Bio", multiline: true }),
github: fields.text({ label: "GitHub Username" }),
avatar: fields.url({ label: "Avatar URL" }),
twitter: fields.url({ label: "Twitter/X" }),
bluesky: fields.url({ label: "Bluesky" }),
mastodon: fields.url({ label: "Mastodon" }),
website: fields.url({ label: "Website" }),
featured: fields.checkbox({ label: "Featured", defaultValue: false }),
},
}),
posts: collection({
label: "Blog Posts",
slugField: "title",
path: "content/posts/*/",
format: { contentField: "content" },
columns: ["publishDate", "author"],
entryLayout: "content",
// previewUrl requires computed year/month — not supported by Keystatic template syntax
schema: {
title: fields.slug({ name: { label: "Title" } }),
publishDate: fields.date({ label: "Publish Date", validation: { isRequired: true } }),
updatedDate: fields.date({ label: "Updated Date" }),
author: fields.text({
label: "Author",
description: `Known authors: ${knownAuthors.join(", ")}`,
validation: { isRequired: true },
}),
description: fields.text({ label: "Description", multiline: true }),
tags: fields.multiselect({
label: "Tags",
options: knownTags.map((t) => ({ label: t, value: t })),
}),
published: fields.checkbox({ label: "Published", defaultValue: true }),
legacyUrl: fields.text({ label: "Legacy Blogger URL" }),
content: fields.markdoc({
label: "Content",
extension: "md",
components: referenceComponents,
}),
},
}),
},
});