import { defineCollection, z, reference } from "astro:content"; import { glob } from "astro/loaders"; const trainers = defineCollection({ loader: glob({ pattern: "**/*.md", base: "./src/content/trainers" }), schema: ({ image }) => z.object({ name: z.string(), image: image(), networks: z.array( z.object({ alt: z.string(), url: z.string().url(), }), ), }), }); const courses = defineCollection({ loader: glob({ pattern: "**/*.{md,mdx}", base: "./src/content/courses" }), schema: ({ image }) => z.object({ id: z.string(), title: z.string(), excerpt: z.string(), slug: z.string(), image: image().optional(), course: z.object({ hours: z.number(), reciclagem: z.boolean().default(false), trainer: reference("trainers").optional(), }), seo: z .object({ tags: z.array(z.string()), }) .optional(), draft: z.boolean().default(true), }), }); export const collections = { trainers, courses };