-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.config.ts
More file actions
43 lines (39 loc) Ā· 1.2 KB
/
content.config.ts
File metadata and controls
43 lines (39 loc) Ā· 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { defineCollection, defineContentConfig, z } from '@nuxt/content'
// Schema for individual instruction steps
const instructionStepSchema = z.object({
text: z.string(),
timer: z.number().optional(), // Timer in seconds (optional)
})
// Schema for instruction groups (e.g., "Preparation", "Cooking")
const instructionGroupSchema = z.object({
title: z.string(),
steps: z.array(instructionStepSchema),
})
const commonSchema = z.object({
title: z.string(),
description: z.string(),
publishedAt: z.date(),
updatedAt: z.date().optional(),
image: z.string().optional(),
imageAlt: z.string().optional(),
category: z.string(),
prepTime: z.number().optional(), // in minutes
cookTime: z.number().optional(), // in minutes
servings: z.number().optional(),
difficulty: z.enum(['easy', 'medium', 'hard']).optional(),
ingredients: z.array(z.string()).optional(),
instructions: z.array(instructionGroupSchema).optional(),
tags: z.array(z.string()).optional(),
})
export default defineContentConfig({
collections: {
recipes: defineCollection({
type: 'page',
source: {
include: 'recipes/*.md',
prefix: 'recipes'
},
schema: commonSchema
}),
}
})