-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathsource.config.ts
More file actions
46 lines (43 loc) · 1.06 KB
/
Copy pathsource.config.ts
File metadata and controls
46 lines (43 loc) · 1.06 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
import {
defineConfig,
defineCollections,
defineDocs,
frontmatterSchema,
} from 'fumadocs-mdx/config';
import { z } from 'zod';
export const docs = defineDocs({
dir: 'content/docs',
docs: {
postprocess: {
includeProcessedMarkdown: true,
},
},
});
export const blog = defineCollections({
type: 'doc',
dir: 'content/blog',
postprocess: {
includeProcessedMarkdown: true,
},
schema: frontmatterSchema.extend({
date: z
.string()
.or(z.date())
.transform((value, context) => {
const parsed = new Date(value);
if (Number.isNaN(parsed.getTime())) {
context.addIssue({ code: 'custom', message: 'Invalid date' });
return z.NEVER;
}
return parsed;
}),
slug: z.string().optional(),
author: z.string().optional(),
authors: z.array(z.string()).optional(),
tags: z.array(z.string()).optional(),
image: z.string().optional(),
series: z.string().optional(),
seriesPart: z.number().int().nonnegative().optional(),
}),
});
export default defineConfig();