-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcontent.config.ts
More file actions
126 lines (119 loc) · 3.47 KB
/
content.config.ts
File metadata and controls
126 lines (119 loc) · 3.47 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import { defineCollection, z } from 'astro:content';
import { glob } from 'astro/loaders';
// Articles collection - 原创文章
const articles = defineCollection({
loader: glob({
pattern: '**/*.{md,mdx}',
base: './src/content/articles'
}),
schema: z.object({
title: z.string(),
description: z.string().optional(),
pubDate: z.coerce.date().optional(),
updatedDate: z.coerce.date().optional(),
authors: z.array(z.string()).optional(),
editors: z.array(z.string()).optional(),
reviewers: z.array(z.string()).optional(),
tags: z.array(z.string()).default([]),
draft: z.boolean().default(false),
})
});
// Monthly collection - 平台工程每月洞察
const monthly = defineCollection({
loader: glob({
pattern: '**/*.{md,mdx}',
base: './src/content/monthly'
}),
schema: z.object({
title: z.string(),
description: z.string().optional(),
pubDate: z.coerce.date().optional(),
updatedDate: z.coerce.date().optional(),
editors: z.array(z.string()).optional(),
reviewers: z.array(z.string()).optional(),
tags: z.array(z.string()).default([]),
draft: z.boolean().default(false),
})
});
// Translations collection - 翻译文章
const translations = defineCollection({
loader: glob({
pattern: '**/*.{md,mdx}',
base: './src/content/translations'
}),
schema: z.object({
title: z.string(),
description: z.string().optional(),
pubDate: z.coerce.date().optional(),
updatedDate: z.coerce.date().optional(),
originalUrl: z.string().url().optional(),
authors: z.array(z.string()).optional(),
translators: z.array(z.string()).optional(),
editors: z.array(z.string()).optional(),
reviewers: z.array(z.string()).optional(),
tags: z.array(z.string()).default([]),
draft: z.boolean().default(false),
})
});
// Events collection - 活动
const events = defineCollection({
loader: glob({
pattern: '**/*.{md,mdx}',
base: './src/content/events'
}),
schema: z.object({
title: z.string(),
description: z.string().optional(),
pubDate: z.coerce.date().optional(),
eventDate: z.coerce.date().optional(),
location: z.string().optional(),
isOnline: z.boolean().default(false),
registrationUrl: z.string().url().optional(),
organizers: z.array(z.string()).optional(),
tags: z.array(z.string()).default([]),
draft: z.boolean().default(false),
})
});
// Glossary collection - 术语表
const glossary = defineCollection({
loader: glob({
pattern: '**/*.{md,mdx}',
base: './src/content/glossary'
}),
schema: z.object({
title: z.string(),
titleEn: z.string().optional(),
abbreviation: z.string().optional(),
description: z.string().optional(),
category: z.enum([
'core-concept', // 核心概念
'platform-product', // 平台产品
'team-role', // 团队角色
'methodology', // 方法论
'user-experience', // 用户体验
'technical-practice' // 技术实践
]).optional(),
relatedTerms: z.array(z.string()).default([]),
tags: z.array(z.string()).default([]),
draft: z.boolean().default(false),
})
});
// Pages collection - 独立页面
const pages = defineCollection({
loader: glob({
pattern: '**/*.{md,mdx}',
base: './src/content/pages'
}),
schema: z.object({
title: z.string(),
description: z.string().optional(),
})
});
export const collections = {
articles,
monthly,
translations,
events,
glossary,
pages,
};