import { defineCollection, z } from "astro:content"; import { file, glob } from "astro/loaders"; const blog = defineCollection({ loader: glob({ pattern: "**/*.md", base: "./src/posts" }), schema: z.object({ title: z.string(), date: z.date(), colour: z.string(), // no alt (empty as decorative) image: z .string() .refine( (value) => value.endsWith(".png"), (val) => ({ message: `${val} must end with .png`, }), ) .optional(), hasMdx: z.boolean().default(false), }), }); const blogMdx = defineCollection({ loader: glob({ pattern: "**/*.mdx", base: "./src/posts" }), schema: z.object({ title: z.string(), }), }); const baseNav = z.object({ slug: z.string(), name: z.string(), }); export type nav = z.infer & { children?: nav[]; }; const navSchema: z.ZodType