forked from railwayapp/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontentlayer.config.ts
More file actions
34 lines (32 loc) · 853 Bytes
/
contentlayer.config.ts
File metadata and controls
34 lines (32 loc) · 853 Bytes
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
import { defineDocumentType, makeSource } from "contentlayer/source-files";
import remarkAutoLinkHeadings from "remark-autolink-headings";
import remarkGfm from "remark-gfm";
import remarkSlug from "remark-slug";
const Page = defineDocumentType(() => ({
name: "Page",
filePathPattern: `**/*.md`,
contentType: "mdx",
fields: {
title: {
type: "string",
description: "The title of the page",
required: true,
},
description: {
type: "string",
description: "The description of the page",
required: true,
},
},
computedFields: {
url: {
type: "string",
resolve: doc => `/${doc._raw.flattenedPath}`,
},
},
}));
export default makeSource({
contentDirPath: "src/docs",
documentTypes: [Page],
mdx: { remarkPlugins: [remarkSlug, remarkAutoLinkHeadings, remarkGfm] },
});