diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-08-13 16:55:43 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-13 16:55:43 -0700 |
| commit | b913e45faa5b9c4d78f1b575818a7e96b8678ce8 (patch) | |
| tree | ed26dde91dfd911b5dec1c207d20fc373d7b382d /src/content/content.config.ts | |
| parent | 357228b0d774da627c4c4840da12e9b57842654b (diff) | |
chore: bump astro to v7
Diffstat (limited to 'src/content/content.config.ts')
| -rw-r--r-- | src/content/content.config.ts | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/content/content.config.ts b/src/content/content.config.ts new file mode 100644 index 0000000..e2c62ca --- /dev/null +++ b/src/content/content.config.ts @@ -0,0 +1,40 @@ +import { defineCollection, z } from 'astro:content'; + +const blog = defineCollection({ + // Type-check frontmatter using a schema + schema: z.object({ + title: z.string(), + description: z.string(), + // Transform string to Date object + pubDate: z + .string() + .or(z.date()) + .transform((val) => new Date(val)), + updatedDate: z + .string() + .optional() + .transform((str) => (str ? new Date(str) : undefined)), + heroImage: z.string().optional(), + }), +}); + +const micro = defineCollection({ + // Type-check frontmatter using a schema + schema: z.object({ + title: z.string(), + description: z.string(), + // Transform string to Date object + pubDate: z + .string() + .or(z.date()) + .transform((val) => new Date(val)), + updatedDate: z + .string() + .optional() + .transform((str) => (str ? new Date(str) : undefined)), + heroImage: z.string().optional(), + }), +}); + + +export const collections = { blog, micro }; |
