Files
portfolio/src/content.config.ts
patrick 653adbe345 refactor: update project data type
- add order property to set explicit ordering on projects page
- make project link optional as not all projects have an accessible link
2026-03-27 14:23:44 -04:00

34 lines
981 B
TypeScript

import { glob } from 'astro/loaders'
import { defineCollection, z } from 'astro:content'
const blog = defineCollection({
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
schema: ({ image }) =>
z.object({
title: z.string(),
description: z.string(),
date: z.coerce.date(),
image: image().optional(),
tags: z.array(z.string()).optional(),
authors: z.array(z.string()).optional(),
draft: z.boolean().optional(),
}),
})
const projects = defineCollection({
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/projects' }),
schema: ({ image }) =>
z.object({
name: z.string(),
description: z.string(),
tags: z.array(z.string()),
image: image(),
link: z.string().url().optional(),
order: z.number().optional(),
startDate: z.coerce.date().optional(),
endDate: z.coerce.date().optional(),
}),
})
export const collections = { blog, projects }