add itens
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user