diff options
author | 2025-06-05 14:25:23 +0000 | |
---|---|---|
committer | 2025-06-05 14:25:23 +0000 | |
commit | e586d7d704d475afe3373a1de6ae20d504f79d6d (patch) | |
tree | 7e3fa24807cebd48a86bd40f866d792181191ee9 /examples/starlog/src/content.config.ts | |
download | astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.tar.gz astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.tar.zst astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.zip |
Sync from a8e1c0a7402940e0fc5beef669522b315052df1blatest
Diffstat (limited to 'examples/starlog/src/content.config.ts')
-rw-r--r-- | examples/starlog/src/content.config.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/starlog/src/content.config.ts b/examples/starlog/src/content.config.ts new file mode 100644 index 000000000..26986525a --- /dev/null +++ b/examples/starlog/src/content.config.ts @@ -0,0 +1,22 @@ +import { glob } from 'astro/loaders'; +import { defineCollection, z } from 'astro:content'; + +const releases = defineCollection({ + // Load Markdown files in the src/content/releases directory. + loader: glob({ base: './src/content/releases', pattern: '**/*.md' }), + // Type-check frontmatter using a schema + schema: ({ image }) => + z.object({ + title: z.string(), + description: z.string(), + versionNumber: z.string(), + image: z.object({ + src: image(), + alt: z.string(), + }), + // Transform string to Date object + date: z.date({ coerce: true }), + }), +}); + +export const collections = { releases }; |