-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontentlayer.config.ts
50 lines (44 loc) · 1.37 KB
/
contentlayer.config.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 {
defineDocumentType,
defineNestedType,
makeSource
} from '@contentlayer/source-files'
const Highlight = defineNestedType(() => ({
name: 'Highlight',
fields: {
_id: { type: 'string', required: true },
text: { type: 'string', required: true },
note: { type: 'string' },
created_at: { type: 'date', required: true },
updated_at: { type: 'date', required: true },
}
}))
const Reference = defineDocumentType(() => ({
name: 'Reference',
filePathPattern: `**/*.md`,
fields: {
_id: { type: 'number', required: true },
link: { type: 'string', required: true },
title: { type: 'string', required: true },
excerpt: { type: 'markdown', },
note: { type: 'string' },
user: { type: 'string', required: true },
cover: { type: 'string', },
tags: { type: 'list', of: { type: 'string' }, },
important: { type: 'boolean', },
created_at: { type: 'date', required: true },
updated_at: { type: 'date', required: true },
highlights: { type: 'list', of: Highlight },
domain: { type: 'string', required: true },
}
}))
export default makeSource({
contentDirPath: process.env.CONTENT_DIR || 'content',
documentTypes: [
Reference,
],
markdown: {
remarkPlugins: [],
rehypePlugins: [],
},
})