summaryrefslogtreecommitdiff
path: root/src/content/config.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/config.ts')
-rw-r--r--src/content/config.ts34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/content/config.ts b/src/content/config.ts
index 43a44ad..4b23736 100644
--- a/src/content/config.ts
+++ b/src/content/config.ts
@@ -1,19 +1,31 @@
import { defineCollection, z } from 'astro:content';
-// Define the blog collection schema
-const blogCollection = defineCollection({
- type: 'content',
+const namesCollection = defineCollection({
+ type: 'data',
schema: z.object({
- title: z.string(),
- description: z.string(),
- pubDate: z.date(),
- image: z.string().optional(),
- author: z.string().default('Anonymous'),
- tags: z.array(z.string()).default([]),
- }),
+ 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 = {
- 'blog': blogCollection,
+ 'names': namesCollection,
};