-
Notifications
You must be signed in to change notification settings - Fork 0
/
contentlayer.config.ts
49 lines (47 loc) · 1.06 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
/* eslint-disable no-underscore-dangle */
import { defineDocumentType, makeSource } from 'contentlayer/source-files';
// Remark packages
import remarkGfm from 'remark-gfm';
// Rehype packages
import rehypePrismPlus from 'rehype-prism-plus';
import remarkCodeTitles from './lib/remark-code-title';
export const Page = defineDocumentType(() => ({
name: 'Page',
filePathPattern: '**/*.md*',
contentType: 'mdx',
fields: {
title: {
type: 'string',
description: 'The title of the page',
required: true,
},
lastUpdatedDate: {
type: 'date',
description: 'Last updated date of the post',
required: true,
},
},
computedFields: {
url: {
type: 'string',
resolve: (post) => `/${post._raw.flattenedPath}`,
},
},
}));
export default makeSource({
contentDirPath: 'content',
documentTypes: [Page],
mdx: {
cwd: process.cwd(),
remarkPlugins: [
remarkGfm,
remarkCodeTitles,
],
rehypePlugins: [
[
rehypePrismPlus,
{ ignoreMissing: true },
],
],
},
});