-
Notifications
You must be signed in to change notification settings - Fork 0
/
contentlayer.config.js
55 lines (53 loc) · 1.23 KB
/
contentlayer.config.js
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
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
import rehypePrism from 'rehype-prism-plus'
const Post = defineDocumentType(() => ({
name: 'Post',
filePathPattern: `**/*.mdx`,
contentType: 'mdx',
fields: {
title: {
type: 'string',
description: 'The title of the post',
required: true
},
date: {
type: 'date',
description: 'The date of the post',
required: true
},
authors: {
type: 'string',
description: 'The author(s) of the post',
required: true
},
visible: {
type: 'boolean',
description: 'Whether this post should appear on the homepage',
required: false,
default: true
},
ogDescription: {
type: 'string',
description: 'The Open Graph description of the post',
required: false
},
color: {
type: 'json',
description: 'The color of the post — appears on card and in background',
required: false
}
},
computedFields: {
url: {
type: 'string',
resolve: (doc) => `/posts/${doc._raw.flattenedPath}`
}
}
}))
export default makeSource({
contentDirPath: 'posts',
documentTypes: [Post],
mdx: {
rehypePlugins: [rehypePrism]
}
})