Dane's personal website
dane.computer
1import { defineCollection, z } from "astro:content";
2import { leafletStaticLoader } from "@nulfrost/leaflet-loader-astro";
3import { glob } from "astro/loaders";
4
5const blogs = defineCollection({
6 loader: glob({ pattern: "**/*.mdx", base: "./src/data/blog" }),
7 schema: z.object({
8 title: z.string(),
9 description: z.string(),
10 publishedAt: z.union([z.date(), z.string()]).transform((val) => {
11 if (val instanceof Date) return val;
12 return new Date(val);
13 }),
14 publication: z.string().optional(),
15 author: z.string().optional(),
16 // Optional fields to match documents structure
17 rkey: z.string().optional(),
18 cid: z.string().optional(),
19 // Keep year for backward compatibility if needed
20 year: z.number().optional(),
21 }),
22});
23
24const documents = defineCollection({
25 loader: leafletStaticLoader({ repo: "did:plc:qttsv4e7pu2jl3ilanfgc3zn" }),
26});
27
28export const collections = { documents, blogs };