summaryrefslogtreecommitdiff
path: root/src/content/config.ts
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2025-06-15 13:44:39 +0200
committerYuval Adam <_@yuv.al>2025-06-15 13:44:39 +0200
commitdd100d4c821aae71f4a43b10843c74f14480bbc0 (patch)
tree6739853a863b26d0a5896796efeb43e27b219586 /src/content/config.ts
parent2e0755cc68e14bda95abe9472754ae5f4e760a04 (diff)
parentabee8fa7e82e66765ca8b513f9dc1a7bac814779 (diff)
Merge remote-tracking branch 'v2/main'
Diffstat (limited to 'src/content/config.ts')
-rw-r--r--src/content/config.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/content/config.ts b/src/content/config.ts
new file mode 100644
index 0000000..4b23736
--- /dev/null
+++ b/src/content/config.ts
@@ -0,0 +1,31 @@
+import { defineCollection, z } from 'astro:content';
+
+const namesCollection = defineCollection({
+ type: 'data',
+ schema: z.object({
+ domain: z.string(),
+ name: z.string(),
+ title: z.string().max(80).optional(),
+ url: z.string().url().optional(),
+ email: z.string().email().optional(),
+ github: z.string().optional(),
+ candidate: z.boolean().optional(),
+ }).refine(
+ (data) => {
+ // If not a candidate, title is required
+ if (!data.candidate) {
+ return !!data.title;
+ }
+ return true;
+ },
+ {
+ message: "Title is required for non-candidates",
+ path: ["title"],
+ }
+ ),
+});
+
+// Export the collections
+export const collections = {
+ 'names': namesCollection,
+};