diff options
Diffstat (limited to 'src/content/config.ts')
| -rw-r--r-- | src/content/config.ts | 31 |
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, +}; |
