Open History to see the last commit
1import { defineCollection, defineConfig } from '@content-collections/core'
2import { compileMarkdown } from '@content-collections/markdown'
3import { z } from 'zod'
4
5const blog = defineCollection({
6 name: 'blog',
7 directory: 'content/blog',
8 include: '**/*.md',
9 schema: z.object({
10 title: z.string(),
11 description: z.string(),
12 pubDate: z.string(),
13 heroImage: z.string().optional(),
14 }),
15 transform: async (document, context) => {
16 return {
17 ...document,
18 slug: document._meta.path,
19 pubDate: new Date(document.pubDate).toISOString(),
20 html: await compileMarkdown(context, document),
21 }
22 },
23})
24
25export default defineConfig({
26 collections: [blog],
27})