-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent-collections.ts
50 lines (48 loc) · 1.12 KB
/
content-collections.ts
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
import { defineCollection, defineConfig } from '@content-collections/core';
import { compileMarkdown } from '@content-collections/markdown';
const index = defineCollection({
name: 'index',
directory: 'src/content',
include: 'index.md',
schema: (z) => ({
title: z.string(),
description: z.string(),
now: z.string(),
tech: z.array(z.string()),
works: z.array(
z.object({
dates: z.string(),
company: z.string(),
title: z.string(),
description: z.string(),
url: z.string(),
})
),
writing: z.array(
z.object({
date: z.string(),
title: z.string(),
description: z.string(),
url: z.string(),
})
),
projects: z.array(
z.object({
title: z.string(),
description: z.string(),
label: z.string().optional(),
url: z.string().optional(),
})
),
}),
transform: async (document, context) => {
const html = await compileMarkdown(context, document);
return {
...document,
html,
};
},
});
export default defineConfig({
collections: [index],
});