init
This commit is contained in:
75
src/content.config.ts
Normal file
75
src/content.config.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import { defineCollection, z, type ImageFunction } from 'astro:content'
|
||||
|
||||
export const coachesSchema = (image: ImageFunction) =>
|
||||
z.object({
|
||||
name: z.string(),
|
||||
description: z.string().optional(),
|
||||
image: image(),
|
||||
imageAlt: z.string(),
|
||||
})
|
||||
|
||||
export const servicesSchema = z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
price: z.string(),
|
||||
link: z.object({
|
||||
title: z.string(),
|
||||
href: z.string(),
|
||||
target: z.string().optional(),
|
||||
}),
|
||||
charachteristics: z.array(
|
||||
z.object({
|
||||
text: z.string(),
|
||||
price: z.string().optional(),
|
||||
})
|
||||
),
|
||||
})
|
||||
|
||||
export const reviewsSchema = (image: ImageFunction) =>
|
||||
z.object({
|
||||
review: z.string(),
|
||||
author: z.object({
|
||||
name: z.string(),
|
||||
description: z.string().optional(),
|
||||
image: image(),
|
||||
imageAlt: z.string(),
|
||||
}),
|
||||
rating: z.number(),
|
||||
})
|
||||
|
||||
const pages = defineCollection({
|
||||
schema: ({ image }) =>
|
||||
z.object({
|
||||
hero: z
|
||||
.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
image: image(),
|
||||
imageAlt: z.string(),
|
||||
cta: z
|
||||
.object({
|
||||
title: z.string(),
|
||||
href: z.string(),
|
||||
target: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.nullable(),
|
||||
marquee: z.array(z.string()).optional(),
|
||||
coaches: z.array(coachesSchema(image)).optional(),
|
||||
reviews: z.array(reviewsSchema(image)).optional(),
|
||||
slider: z
|
||||
.array(
|
||||
z.object({
|
||||
image: image(),
|
||||
imageAlt: z.string(),
|
||||
})
|
||||
)
|
||||
.optional(),
|
||||
services: z.array(servicesSchema).optional(),
|
||||
}),
|
||||
})
|
||||
|
||||
export const collections = {
|
||||
pages,
|
||||
}
|
||||
Reference in New Issue
Block a user