Files for my website
bwc9876.dev
1import { defineCollection } from "astro:content";
2import { glob } from "astro/loaders";
3import { z } from "astro/zod";
4
5const projectsCollection = defineCollection({
6 loader: glob({ pattern: "**/[^_]*.{md,mdx}", base: "./src/content/projects" }),
7 schema: ({ image }) =>
8 z.object({
9 name: z.string(),
10 summary: z.string(),
11 tags: z.array(z.string()),
12 timespan: z.object({
13 from: z.number(),
14 to: z.number().or(z.string()).optional()
15 }),
16 internalSort: z.number().optional(),
17 image: image(),
18 links: z
19 .object({
20 github: z.string().optional(),
21 other: z
22 .array(
23 z.object({
24 label: z.string(),
25 url: z.string(),
26 icon: z.string().default("link-45deg"),
27 iconPackOverride: z.string().optional()
28 })
29 )
30 .optional()
31 })
32 .optional()
33 })
34});
35
36const blogPostsCollection = defineCollection({
37 loader: glob({ pattern: "**/[^_]*.{md,mdx}", base: "./src/content/posts" }),
38 schema: z.object({
39 title: z.string(),
40 date: z.date(),
41 summary: z.string(),
42 cowsay: z.string()
43 })
44});
45
46export const collections = {
47 projects: projectsCollection,
48 posts: blogPostsCollection
49};