add itens

This commit is contained in:
2025-04-17 11:43:26 -03:00
parent af15518b21
commit 1f9754f681
12 changed files with 204 additions and 161 deletions

View File

@@ -1,13 +1,32 @@
import { defineCollection, z } from 'astro:content'
import { defineCollection, z, reference } from 'astro:content'
import { glob } from 'astro/loaders'
const trainers = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/data/trainers' }),
schema: z.object({
name: z.string(),
bio: z.string(),
}),
})
const courses = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/data/courses' }),
schema: z.object({
id: z.string(),
title: z.string(),
slug: z.string(),
course: z.object({
hours: z.number(),
modules: z.array(z.string()),
trainer: reference('trainers').optional(),
}),
seo: z
.object({
tags: z.array(z.string()),
})
.optional(),
draft: z.boolean().default(true),
}),
})
export const collections = { courses }
export const collections = { trainers, courses }