Skip to content

Commit 56a4a42

Browse files
committed
🍻 content config
1 parent 67b9f10 commit 56a4a42

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineCollection, z } from 'astro:content';
2+
import { glob } from 'astro/loaders';
3+
4+
const blahg = defineCollection({
5+
loader: glob({ pattern: '**/[!_]*.md', base: './src/content/blahg' }),
6+
schema: z.object({
7+
title: z.string(),
8+
description: z.string(),
9+
pageTitle: z.string().optional(),
10+
pageDescription: z.string().optional(),
11+
pubDate: z
12+
.string()
13+
.or(z.date())
14+
.transform((val) => new Date(val)),
15+
updatedDate: z
16+
.string()
17+
.optional()
18+
.transform((str) => (str ? new Date(str) : undefined)),
19+
heroImage: z.string().optional(),
20+
heroImageDesc: z.string().optional(),
21+
series: z.string().optional(),
22+
schemaType: z.string().default('BlogPosting'),
23+
}),
24+
});
25+
26+
export const collections = { blahg };

0 commit comments

Comments
 (0)