import { defineCollection } from 'astro:content'; import { glob } from 'astro/loaders'; import { z } from 'astro/zod'; const postSchema = z.object({ title: z.string(), subtitle: z.string(), description: z.string(), image: z.object({ path: z.string(), alt: z.string() }), author: z.string(), date: z.coerce.date(), slug: z.string(), time2read: z.int() }); export type PostData = z.infer; const posts = defineCollection({ loader: glob({ pattern: "**/*.{md,mdx}", base: "./src/pages/blog/", }), schema: postSchema }); export const collections = { posts };