-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.config.ts
More file actions
61 lines (55 loc) · 1.62 KB
/
content.config.ts
File metadata and controls
61 lines (55 loc) · 1.62 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
import type { DefinedCollection } from '@nuxt/content'
import { defineContentConfig, defineCollection, z } from '@nuxt/content'
import { useNuxt } from '@nuxt/kit'
import { joinURL } from 'ufo'
const { options } = useNuxt()
const cwd = joinURL(options.rootDir, 'content')
const createDocsSchema = () => z.object({
title: z.string(),
description: z.string(),
type: z.string().optional(),
platform: z.string().optional(),
active: z.boolean().default(true).optional(),
featured: z.number().optional(),
featured_description: z.string().optional(),
featured_icon: z.string().optional(),
github: z.string().optional(),
list_title: z.string().optional(),
system: z.string().optional(),
system_url: z.string().optional(),
layout: z.string().optional(),
links: z.array(z.object({
label: z.string(),
icon: z.string(),
to: z.string(),
target: z.string().optional(),
})).optional(),
})
let collections: Record<string, DefinedCollection> = {
landing: defineCollection({
type: 'page',
source: {
cwd,
include: 'index.md',
},
}),
docs: defineCollection({
type: 'page',
source: {
cwd,
include: '**',
exclude: ['index.md'],
},
schema: createDocsSchema(),
}),
data: defineCollection({
type: 'data',
source: {
cwd: joinURL(options.rootDir, 'data'),
include: '**/*.json',
exclude: [],
},
schema: createDocsSchema(),
}),
}
export default defineContentConfig({ collections })