forked from openclaw/openclaw.ai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.config.ts
More file actions
43 lines (40 loc) · 1.23 KB
/
Copy pathcontent.config.ts
File metadata and controls
43 lines (40 loc) · 1.23 KB
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
43
import { defineCollection, z } from 'astro:content';
import { glob } from 'astro/loaders';
const authorSchema = z.object({
name: z.string(),
title: z.string().optional(),
org: z.string().optional(),
handle: z.string().optional(),
url: z.string().optional(),
links: z.array(z.object({
label: z.string(),
url: z.string(),
})).optional(),
avatar: z.string().optional(),
});
const blog = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
schema: z.object({
title: z.string(),
description: z.string(),
date: z.date(),
// Single author (legacy)
author: z.string().optional(),
authorHandle: z.string().optional(),
authorUrl: z.string().optional(),
authorAvatar: z.string().optional(),
// Multiple authors
authors: z.array(authorSchema).optional(),
draft: z.boolean().default(false),
tags: z.array(z.string()).default([]),
coverImage: z.string().optional(),
image: z.string().optional(),
ogImage: z.object({
src: z.string(),
width: z.number().int().positive(),
height: z.number().int().positive(),
type: z.enum(['image/png', 'image/jpeg', 'image/webp']),
}).optional(),
}),
});
export const collections = { blog };