this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at fix-the-posts-oml 49 lines 1.1 kB view raw
1import { defineCollection, z } from "astro:content"; 2import { file, glob } from "astro/loaders"; 3 4const blog = defineCollection({ 5 loader: glob({ pattern: "**/*.md", base: "./src/posts" }), 6 schema: z.object({ 7 title: z.string(), 8 date: z.date(), 9 colour: z.string(), 10 // no alt (empty as decorative) 11 image: z 12 .string() 13 .refine( 14 (value) => value.endsWith(".png"), 15 (val) => ({ 16 message: `${val} must end with .png`, 17 }), 18 ) 19 .optional(), 20 hasMdx: z.boolean().default(false), 21 }), 22}); 23 24const blogMdx = defineCollection({ 25 loader: glob({ pattern: "**/*.mdx", base: "./src/posts" }), 26 schema: z.object({ 27 title: z.string(), 28 }), 29}); 30 31const baseNav = z.object({ 32 slug: z.string(), 33 name: z.string(), 34}); 35 36export type nav = z.infer<typeof baseNav> & { 37 children?: nav[]; 38}; 39 40const navSchema: z.ZodType<nav> = baseNav.extend({ 41 children: z.lazy(() => navSchema.array()), 42}); 43 44const nav = defineCollection({ 45 loader: file("src/navList.json"), 46 schema: navSchema, 47}); 48 49export const collections = { blog, blogMdx, nav };