-
Notifications
You must be signed in to change notification settings - Fork 3
/
contentlayer.config.ts
100 lines (98 loc) · 1.74 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { defineDocumentType, makeSource } from 'contentlayer/source-files';
import { slugify } from './utils';
const Post = defineDocumentType(() => ({
name: 'Post',
filePathPattern: `posts/**/*.md`,
contentType: 'markdown',
fields: {
title: {
type: 'string',
},
date: {
type: 'date',
},
author: {
type: 'string',
},
description: {
type: 'string',
},
slug: {
type: 'string',
},
id: {
type: 'number',
},
image: {
type: 'string',
},
draft: {
type: 'boolean',
},
tags: {
type: 'list',
of: { type: 'string' },
},
categories: {
type: 'list',
of: { type: 'string' },
},
},
computedFields: {
slug: {
type: 'string',
resolve: (doc) => slugify(doc._raw.sourceFileName.replace(/\.md/, '')),
},
},
}));
const Package = defineDocumentType(() => ({
name: 'Package',
filePathPattern: `packages/**/*.md`,
contentType: 'markdown',
fields: {
title: {
type: 'string',
},
author: {
type: 'string',
},
logo: {
type: 'string',
},
org_name: {
type: 'string',
},
org_link: {
type: 'string',
},
repo_name: {
type: 'string',
},
repo_link: {
type: 'string',
},
version: {
type: 'string',
},
installation: {
type: 'string',
},
about: {
type: 'string',
},
badges_body: {
type: 'string',
},
},
computedFields: {
slug: {
type: 'string',
resolve: (doc) => slugify(doc._raw.sourceFileName.replace(/\.md/, '')),
},
},
}));
export default makeSource({
contentDirPath: '.',
contentDirInclude: [],
documentTypes: [Post, Package],
});