-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.config.ts
More file actions
431 lines (412 loc) · 15.9 KB
/
content.config.ts
File metadata and controls
431 lines (412 loc) · 15.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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
import { defineCollection, z } from 'astro:content';
import { parseNewsFrontmatterDate } from './lib/dates';
import { glob } from 'astro/loaders';
/** `src/content/<name>/` — absolute file URL avoids resolving `./src/...` from the wrong cwd. */
function contentGlobBase(segment: string) {
return new URL(`./content/${segment}/`, import.meta.url);
}
const mastheadTopicItemSchema = z.union([
z.string(),
z.object({
label: z.string(),
tone: z.enum(['core', 'code', 'apps', 'seminar', 'neutral']).optional(),
}),
]);
/**
* Dispatch labels — named slots (flattened to pills in order:
* researchField → applicationDomain → task).
*/
const structuredTopicsSchema = z
.object({
researchField: mastheadTopicItemSchema.optional(),
applicationDomain: mastheadTopicItemSchema,
task: mastheadTopicItemSchema,
})
.optional();
const people = defineCollection({
loader: glob({ pattern: '**/*.md', base: contentGlobBase('people') }),
schema: z.object({
name: z.string(),
role: z.string(),
/** Section on the People page (current vs alumni subsections). */
peopleTier: z
.enum(['faculty', 'postdoc', 'phd', 'ms', 'undergrad', 'research_assistant', 'visitor'])
.default('visitor'),
current: z.boolean().default(true),
/** Cohort / program label shown when term range isn’t used */
cohort: z.string().optional(),
/** If set, shown under the name on `/people/` and the profile hero instead of term range/cohort */
directoryMeta: z.string().optional(),
/** Academic start semester, e.g. `Fall 2021` — drives People sort order */
startTerm: z.string().optional(),
/** End semester or `Present` if omitted while `current` */
endTerm: z.string().optional(),
website: z.string().url().optional(),
github: z.string().url().optional(),
linkedin: z.string().url().optional(),
/** Google Scholar profile URL — prefer if set; Semantic Scholar remains optional separately. */
googleScholar: z.string().url().optional(),
semanticScholar: z.string().url().optional(),
photo: z.string().optional(),
/**
* Optional wide photo shown after Education / theses / publications / achievements on the profile page.
* Path under `public/` (e.g. `/news/…`).
*/
footerPhoto: z
.object({
src: z.string(),
alt: z.string().optional(),
caption: z.string().optional(),
})
.optional(),
/** Optional extra photos after Education / thesis / publications / achievements (after `footerPhoto` if set). */
footerPhotos: z
.array(
z.object({
src: z.string(),
alt: z.string().optional(),
caption: z.string().optional(),
}),
)
.optional(),
aliases: z.array(z.string()).optional(),
/**
* Alternate author strings used on papers/theses only (normalized + linked on `/papers/`).
* Omit from roster display / profile parentheticals (`aliases` is for preferred/nickname display).
*/
publicationAuthorAliases: z.array(z.string()).optional(),
/** When `false`, omit the auto-linked Publications section on this profile. */
profilePublications: z.boolean().optional(),
/**
* Honors, grants, competition results, etc.
* Prefer `title` (what happened) + `when` (timing) + optional `issuer` (who gave it) instead of one long `title` string.
* Legacy entries may still embed dates in `title`; the site splits trailing `(...)` when it looks date-like.
* Editorial style: short noun-first lines; em dash for results (`Contest — 1st place (Team)`); awards as `Award, Emory Computer Science`.
* Do not list undergraduate thesis honor level here (`Highest Honor in …`, etc.) — use `honorsLevel` on the linked thesis entry for the thesis detail page; the people profile thesis list omits it (see Achievements).
*/
achievements: z
.array(
z.object({
title: z.string(),
when: z.string().optional(),
issuer: z.string().optional(),
url: z.string().optional(),
}),
)
.optional(),
/** Degrees/postdoc training etc.; Education lists show `endYear` only. Composed bios use `endTerm` when set (`Spring 2026`), else `endYear`. Optional `startTerm` / `endTerm` also affect bio sort order. */
education: z
.array(
z.object({
degree: z.string(),
institution: z.string(),
/** e.g. `Fall 2021` — optional; composed-bio chronological sort. */
startTerm: z.string().optional(),
/** e.g. `Spring 2026` — optional; shown in composed bio; Education list still shows `endYear`. */
endTerm: z.string().optional(),
endYear: z.number().int().optional(),
ongoing: z.boolean().optional(),
notes: z.string().optional(),
}),
)
.optional(),
}),
});
const papers = defineCollection({
loader: glob({ pattern: '**/*.md', base: contentGlobBase('papers') }),
schema: z.object({
title: z.string(),
/** Trim each line — avoids stray spaces before/after commas in listings. */
authors: z.array(z.string()).transform((authors) => authors.map((s) => s.trim())),
venue: z.string(),
/** Short listing badge (rail); inferred from venue when omitted. */
venueAbbrev: z.string().optional(),
year: z.number().int(),
abstract: z.string().optional(),
/** Repository, Hugging Face model/dataset, or other artifact (shown as “Resources” on the paper page). */
resourceUrl: z.string().optional(),
/** @deprecated Use `resourceUrl` — still accepted for older posts. */
codeUrl: z.string().optional(),
/** Canonical paper/preprint landing (ACL page, DOI, arXiv abs, …). Detail page Links row omits PDF/Bib only. */
paperUrl: z.string().url().optional(),
/** Poster PDF or landing URL — shown in the Links row after Paper / Resources. */
posterUrl: z.string().url().optional(),
/** Slides PDF or deck URL — shown in the Links row. */
slidesUrl: z.string().url().optional(),
/** Venue row hyperlink — used verbatim when set (e.g. journal portal). */
venueUrl: z.string().url().optional(),
publicationType: z.enum(['conference', 'journal', 'preprint', 'workshop', 'other']).optional(),
/** Optional masthead line (reserved; not shown on the `/papers/` cards). */
masthead: z.string().optional(),
/** Named Dispatch labels: `applicationDomain` + `task`; optional `researchField`. */
topics: structuredTopicsSchema,
/** Listing teaser copy; otherwise first sentence of `abstract`, or truncated abstract. See `publicationDek`. */
dek: z.string().optional(),
/** Detail page: optional footnote after authors, shown as `*: …` (e.g. proceedings vs arXiv). */
authorFootnote: z.string().optional(),
/** Must match an `authors` entry exactly; that name is shown with a trailing `*`. */
authorFootnoteFor: z.string().optional(),
/** Detail page row below Links (“Present”). Multiple people: comma-separated (split on commas); each segment is matched to `/people/` like `authors`. */
presenter: z.string().optional(),
/**
* Calendar date when the paper was published or presented (`YYYY-MM-DD` recommended).
* Drives `/papers/` listing order (newer first); if omitted, sort uses Jan 1 of `year`.
* When `forthcoming` is true, omit this (no placeholder date); listing sort uses end of `year` instead.
*/
published: z
.union([z.string(), z.date()])
.optional()
.transform((val): Date | undefined => {
if (val === undefined) return undefined;
return parseNewsFrontmatterDate(val);
}),
/** Accepted or in press — not yet published; do not set a fake `published` date. Sorting stays stable (see `publicationSortInstant`). */
forthcoming: z.boolean().optional(),
}),
});
const theses = defineCollection({
loader: glob({ pattern: '**/*.md', base: contentGlobBase('theses') }),
schema: z.object({
title: z.string(),
author: z.string(),
degree: z.enum([
'PhD',
'MS',
'BS',
'BA',
'Undergraduate Honors',
'Undergraduate Thesis',
'Masters Thesis',
'Dissertation',
'Other',
]),
abstract: z.string().optional(),
term: z.string().optional(),
department: z.string().optional(),
paperUrl: z.string().url().optional(),
slidesUrl: z.string().url().optional(),
committee: z.array(z.string()).optional(),
honorsLevel: z.enum(['Highest Honor', 'High Honor', 'Honor']).optional(),
photo: z.string().optional(),
sourceUrl: z.string().url().optional(),
/** Optional topic labels for Dispatch; when omitted, inferred from title and abstract. */
topics: structuredTopicsSchema,
}),
});
const dispatchActivityKind = z.enum(['award', 'media', 'service', 'travel', 'welcome', 'social', 'other']);
const dispatchDistinctionKind = z.enum(['award', 'honor', 'other']);
const dispatchFeaturedFlag = z.literal(true).optional();
const dispatchNewsLineItem = z.object({
date: z.union([z.string(), z.date()]).transform((val) => parseNewsFrontmatterDate(val)),
text: z.string(),
highlight: z.string().optional(),
featured: dispatchFeaturedFlag,
blurb: z.string().optional(),
});
const dispatchPublicationRef = z.union([
z.string(),
z.object({
publication: z.string(),
featured: dispatchFeaturedFlag,
blurb: z.string().optional(),
}),
]);
const dispatchThesisRef = z.union([
z.string(),
z.object({
thesis: z.string(),
featured: dispatchFeaturedFlag,
blurb: z.string().optional(),
}),
]);
const dispatchColumnFormat = z.enum(['full', 'external']);
const dispatchColumns = defineCollection({
loader: glob({ pattern: '**/*.md', base: contentGlobBase('dispatch-columns') }),
schema: z
.object({
/** Dispatch issue slug this column belongs to (e.g. `2026-spring`). */
issue: z.string(),
/** `full` — markdown body on the issue page; `external` — teaser linking to source. */
format: dispatchColumnFormat.default('full'),
headline: z.string(),
/** Full-format pull quote shown above the body. */
pullQuote: z.string().optional(),
/** External-format subtitle (e.g. Substack dek). */
subtitle: z.string().optional(),
/** External-format hook line under the subtitle. */
tagline: z.string().optional(),
/** External-format episode or article summary. */
summary: z.string().optional(),
/** External-format SEO / social meta description from the source page. */
seoDescription: z.string().optional(),
/** Cover image path under `public/` (e.g. `/dispatch/2026-spring-lights-out-web-1.webp`). */
coverImage: z.string().optional(),
/** CSS object-position for the cover image. */
coverImagePosition: z.string().optional(),
byline: z.string().optional(),
/** Publication date (e.g. on Substack). */
published: z.coerce.date().optional(),
/** Photo path under `public/` (e.g. `/people/jinho-choi.webp`). */
avatar: z.string().optional(),
/** Canonical URL when republished from elsewhere (e.g. Substack). */
sourceUrl: z.string().url().optional(),
sourceLabel: z.string().optional(),
/** iframe `src` for an embedded player (e.g. Substack post embed). */
embedUrl: z.string().url().optional(),
/** Footnote shown below external teasers (e.g. podcast disclaimer). */
note: z.string().optional(),
})
.superRefine((data, ctx) => {
if (data.format === 'full' && !data.pullQuote?.trim()) {
ctx.addIssue({
code: 'custom',
message: 'pullQuote is required when format is full',
path: ['pullQuote'],
});
}
if (data.format === 'external') {
if (!data.sourceUrl) {
ctx.addIssue({
code: 'custom',
message: 'sourceUrl is required when format is external',
path: ['sourceUrl'],
});
}
for (const field of ['subtitle', 'summary'] as const) {
if (!data[field]?.trim()) {
ctx.addIssue({
code: 'custom',
message: `${field} is required when format is external`,
path: [field],
});
}
}
}
}),
});
const dispatchHomepageHighlight = z
.object({
kind: z.string(),
label: z.string().optional(),
publication: z.string().optional(),
column: z.string().optional(),
highlight: z.string().optional(),
tagTone: z.enum(['core', 'code', 'apps', 'seminar', 'neutral']).optional(),
})
.superRefine((item, ctx) => {
const refs = [item.publication, item.column, item.highlight].filter(Boolean);
if (refs.length !== 1) {
ctx.addIssue({
code: 'custom',
message: 'Each homepage highlight must set exactly one of publication, column, or highlight',
path: ['publication'],
});
}
});
const dispatch = defineCollection({
loader: glob({ pattern: '**/*.md', base: contentGlobBase('dispatch') }),
schema: z.object({
issueTitle: z.string(),
volume: z.number().int(),
issue: z.number().int(),
periodLabel: z.string(),
periodStart: z.coerce.date(),
periodEnd: z.coerce.date(),
published: z.coerce.date(),
tagline: z.string().optional(),
papers: z.array(dispatchPublicationRef),
/** Omit or leave empty to hide the theses section on the issue page. */
theses: z.array(dispatchThesisRef).optional(),
/** Highlights shown on the home page from the current dispatch issue. */
homepageHighlights: z.array(dispatchHomepageHighlight).optional(),
/** Ordered column article slugs (`src/content/dispatch-columns/`). */
columns: z.array(z.string()),
/** Omit to hide the student spotlight section on the issue page. */
studentSpotlight: z
.object({
name: z.string(),
degree: z.string(),
blurb: z.string(),
project: z.string(),
personSlug: z.string().optional(),
photo: z.string().optional(),
})
.optional(),
/** Omit or leave empty to hide the Distinctions section on the issue page. */
distinctions: z
.array(
dispatchNewsLineItem.extend({
kind: dispatchDistinctionKind,
}),
)
.optional(),
activityNews: z.array(
dispatchNewsLineItem.extend({
kind: dispatchActivityKind.optional(),
}),
),
/** Omit to hide the reading list section on the issue page. */
readingList: z
.array(
z.object({
why: z.string(),
publication: z.string().optional(),
title: z.string().optional(),
authors: z.string().optional(),
venue: z.string().optional(),
url: z.string().url().optional(),
}),
)
.optional(),
heroVisual: z.enum(['radar', 'graph', 'tree']).optional(),
/** Short paragraph summarizing the issue’s key points (cover + archive). */
issueSummary: z.string().optional(),
}),
});
const seminars = defineCollection({
loader: glob({ pattern: '**/*.md', base: contentGlobBase('seminars') }),
schema: z.object({
title: z.string(),
date: z.coerce.date(),
term: z.string(),
/** Wall-clock time line from the legacy seminar page (e.g. `3:00 - 4:00 PM`). */
time: z.string().optional(),
speakers: z.array(z.string()).optional(),
abstract: z.string().optional(),
/** Guest or speaker biography; rendered like the abstract on the detail page. */
bio: z.string().optional(),
location: z.string().optional(),
videoUrl: z.string().url().optional(),
slidesUrl: z.string().url().optional(),
/** Speaker homepage (guest talks without a people profile). */
speakerUrl: z.string().url().optional(),
/** Cover image path under `public/` (e.g. `/seminars/*.webp`). */
coverImage: z.string().optional(),
}),
});
const news = defineCollection({
loader: glob({ pattern: '**/*.md', base: contentGlobBase('news') }),
schema: z.object({
title: z.string(),
/** `YYYY-MM-DD` (UTC), `YYYY-MM-DD-HH:MM` (Eastern wall time), or any string JS `Date` accepts */
date: z.union([z.string(), z.date()]).transform((val): Date => parseNewsFrontmatterDate(val)),
featured: z.boolean().optional(),
/** Cover image path under `public/` (e.g. `/news/*.jpg`) — listing thumbnails and home carousel */
coverImage: z.string().optional(),
/** CSS object-position for listing and home cover thumbnails only (cards, carousel). Not applied to images inside the article body. */
coverImagePosition: z.string().optional(),
/** Free-form labels rendered as pills, e.g. `social`, `paper`, `visit`, `conferences` */
labels: z.array(z.string()).optional(),
/** People slugs (`src/content/people/{slug}.md`). Missing files still render (name derived from slug); add profiles to enable links + People page listings. */
participants: z.array(z.string()).optional(),
}),
});
export const collections = {
people,
papers,
theses,
dispatch,
dispatchColumns,
seminars,
news,
};