-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeystatic.config.tsx
More file actions
184 lines (180 loc) · 4.53 KB
/
keystatic.config.tsx
File metadata and controls
184 lines (180 loc) · 4.53 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
import { config, fields, collection } from "@keystatic/core";
import { inline } from "@keystatic/core/content-components";
const knownAuthors = [
"A. Jesse Jiryu Davis",
"A.M. Kuchling",
"Alex Waygood",
"Anthony Scopatz",
"Betsy Waliszewski",
"Brian Curtin",
"Charles Freeborn",
"Cheuk Ting Ho",
"Christopher Neugebauer",
"Christy Heaton",
"Craig Lang",
"David Goodger",
"David Mertz",
"Deb Nicholson",
"Diana Clarke",
"Doug Hellmann",
"Doug Napoleone",
"Ee Durbin",
"Eric Holscher",
"Erika Pelaez",
"Ewa Jodlowska",
"Georgi Ker",
"Jackie Kazil",
"Jessica McKellar",
"Joanna Jablonski",
"Kushal Das",
"Loren Crary",
"Lorena Mesa",
"Marc-Andre Lemburg",
"Marie Nordin",
"Michael Foord",
"Mike Driscoll",
"Naomi Ceder",
"Nicholas Tollervey",
"Nicole Harris",
"Olivia Sauls",
"Pablo Galindo",
"Quan Nguyen",
"Seth Michael Larson",
"Sumana Harihareswara",
"Tania Allard",
"Thomas Wouters",
"Łukasz Langa",
];
const knownTags = [
"PSF",
"community",
"pycon",
"election",
"board",
"grants",
"diversity",
"open source",
"education",
"sponsorship",
"membership",
"community service awards",
"conference",
"development",
"donations",
"infrastructure",
"pypi",
"pip",
"packaging",
"sprints",
"volunteer",
];
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 !== "production"
? { kind: "local" }
: { kind: "cloud" },
cloud: {
project: "psf/blog",
},
collections: {
authors: collection({
label: "Authors",
slugField: "name",
path: "content/authors/*",
format: "json",
previewUrl: "/authors/{slug}",
columns: ["name", "postCount", "featured"],
schema: {
name: fields.slug({ name: { label: "Name" } }),
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 }),
postCount: fields.integer({ label: "Post Count", defaultValue: 0 }),
},
}),
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,
}),
},
}),
},
});