Skip to content

Commit 9cf0a12

Browse files
authored
🔖 - Version 1.1.0 (#13)
2 parents e219fac + 7457ca2 commit 9cf0a12

25 files changed

+10044
-2359
lines changed

‎.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37+
38+
.contentlayer

‎.prettierrc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
{
2-
"trailingComma": "es5",
3-
"tabWidth": 2,
4-
"semi": false,
5-
"singleQuote": true,
6-
"printWidth": 120
2+
"tabWidth": 2
73
}

‎contentlayer.config.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { defineDocumentType, makeSource } from 'contentlayer/source-files'
2+
import rehypeCodeTitles from 'rehype-code-titles'
3+
import rehypePrettyCode from 'rehype-pretty-code'
4+
5+
export const Blog = defineDocumentType(() => ({
6+
name: 'Blog',
7+
filePathPattern: `blog/*.mdx`,
8+
contentType: 'mdx',
9+
fields: {
10+
title: { type: 'string', required: true },
11+
date: { type: 'date', required: true },
12+
description: { type: 'string', required: true },
13+
thumbnailUrl: { type: 'string', required: true },
14+
author: { type: 'string', required: true },
15+
},
16+
computedFields: {
17+
slug: {
18+
type: 'string',
19+
resolve: (post) => post._raw.sourceFileName.replace('.mdx', ''),
20+
},
21+
},
22+
}))
23+
24+
export default makeSource({
25+
contentDirPath: 'posts',
26+
documentTypes: [Blog],
27+
mdx: {
28+
rehypePlugins: [
29+
rehypeCodeTitles,
30+
[
31+
// @ts-ignore
32+
rehypePrettyCode,
33+
{
34+
theme: 'github-dark',
35+
defaultLang: 'plaintext',
36+
},
37+
],
38+
],
39+
},
40+
})

‎next.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
const { withContentlayer } = require('next-contentlayer')
2+
13
/** @type {import('next').NextConfig} */
2-
const nextConfig = {
3-
reactStrictMode: true,
4-
}
4+
const nextConfig = { reactStrictMode: true, swcMinify: true }
55

6-
module.exports = nextConfig
6+
module.exports = withContentlayer(nextConfig)

0 commit comments

Comments
 (0)