forked from dkast/biztro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent-collections.ts
More file actions
42 lines (40 loc) · 959 Bytes
/
Copy pathcontent-collections.ts
File metadata and controls
42 lines (40 loc) · 959 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
35
36
37
38
39
40
41
42
import { defineCollection, defineConfig } from "@content-collections/core"
import { compileMDX } from "@content-collections/mdx"
import rehypePrettyCode from "rehype-pretty-code"
import remarkGfm from "remark-gfm"
import { z } from "zod/v4"
const posts = defineCollection({
name: "posts",
directory: "content/blog",
include: "**/*.mdx",
schema: z.object({
title: z.string(),
category: z.string(),
description: z.string(),
date: z.iso.date(),
author: z.string(),
position: z.string(),
avatar: z.string(),
content: z.string()
}),
transform: async (document, context) => {
const body = await compileMDX(context, document, {
rehypePlugins: [
[
rehypePrettyCode,
{
theme: "poimandres"
}
]
],
remarkPlugins: [remarkGfm]
})
return {
...document,
body
}
}
})
export default defineConfig({
collections: [posts]
})