-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontent.config.ts
More file actions
82 lines (78 loc) · 2.03 KB
/
content.config.ts
File metadata and controls
82 lines (78 loc) · 2.03 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { defineContentConfig, defineCollection, z } from '@nuxt/content';
const createAuthorSchema = () =>
z.object({
name: z.string(),
description: z.string().optional(),
username: z.string().optional(),
twitter: z.string().optional(),
to: z.string().optional(),
avatar: createImageSchema().optional(),
});
const createImageSchema = () =>
z.object({
src: z.string().editor({ input: 'media' }),
alt: z.string(),
});
const docsSource = {
cwd: process.env.VERCUBE_PATH ?? undefined,
repository: process.env.VERCUBE_PATH ? undefined : 'https://github.com/vercube/vercube/tree/main',
include: 'docs/**/*',
exclude: ['docs/**/*.json'],
prefix: '/docs',
};
export default defineContentConfig({
collections: {
index: defineCollection({
type: 'data',
source: 'index.yml',
schema: z.object({
hero: z.object({
title: z.string(),
description: z.string(),
slug: z.string(),
tabs: z.array(
z.object({
title: z.string(),
content: z.string(),
}),
),
}),
}),
}),
landing: defineCollection({
type: 'page',
source: 'index.md',
}),
docs: defineCollection({
type: 'page',
source: [docsSource],
schema: z.object({
links: z
.array(
z.object({
label: z.string(),
icon: z.string(),
to: z.string(),
target: z.string().optional(),
}),
)
.optional(),
}),
}),
pages: defineCollection({
type: 'page',
source: [{ include: 'blog.yml' }],
}),
blog: defineCollection({
type: 'page',
source: 'blog/*.md',
schema: z.object({
minRead: z.number(),
date: z.date(),
image: z.string().nonempty().editor({ input: 'media' }).optional(),
shortImage: z.string().nonempty().editor({ input: 'media' }).optional(),
author: createAuthorSchema(),
}),
}),
},
});