From e586d7d704d475afe3373a1de6ae20d504f79d6d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Jun 2025 14:25:23 +0000 Subject: Sync from a8e1c0a7402940e0fc5beef669522b315052df1b --- examples/starlog/src/content.config.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/starlog/src/content.config.ts (limited to 'examples/starlog/src/content.config.ts') 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 }; -- cgit v1.2.3