-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcontent.config.ts
More file actions
32 lines (29 loc) · 975 Bytes
/
content.config.ts
File metadata and controls
32 lines (29 loc) · 975 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
import { defineCollection, z } from "astro:content";
import { glob } from "astro/loaders";
const posts = defineCollection({
loader: glob({ pattern: "*/index.{md,mdx}", base: "./content/posts" }),
schema: z.object({
title: z.string(),
publishDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
author: z.string(),
description: z.string().optional(),
tags: z.array(z.string()).default([]),
published: z.boolean().default(true),
legacyUrl: z.string().optional(),
}),
});
const authors = defineCollection({
loader: glob({ pattern: "*.json", base: "./content/authors" }),
schema: z.object({
name: z.string(),
bio: z.string().optional(),
github: z.string().optional(),
avatar: z.string().optional(),
bluesky: z.string().optional(),
mastodon: z.string().optional(),
website: z.string().optional(),
featured: z.boolean().default(false),
}),
});
export const collections = { posts, authors };