-
Notifications
You must be signed in to change notification settings - Fork 24
/
contentlayer.config.ts
30 lines (27 loc) · 806 Bytes
/
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
// contentlayer.config.ts
import { defineDocumentType, makeSource } from 'contentlayer2/source-files'
import mdxOptions from './mdxOptions.mjs'
export const Article = defineDocumentType(() => ({
name: 'Article',
filePathPattern: `**/*.mdx`,
contentType: 'mdx',
fields: {
titre: { type: 'markdown', required: true },
date: { type: 'date', required: true },
description: { type: 'string', required: true },
image: { type: 'string', required: false },
tags: { type: 'list', of: { type: 'string' }, required: false },
bluesky: { type: 'string', required: false },
},
computedFields: {
url: {
type: 'string',
resolve: (post) => `/blog/${post._raw.flattenedPath}`,
},
},
}))
export default makeSource({
contentDirPath: 'articles',
documentTypes: [Article],
mdx: mdxOptions,
})