mirror of
https://github.com/cupcakearmy/nicco.io.git
synced 2026-10-23 02:51:46 +00:00
26 lines
728 B
TypeScript
26 lines
728 B
TypeScript
import { defineCollection } from 'astro:content'
|
|
import { z } from 'astro/zod'
|
|
import { glob } from 'astro/loaders'
|
|
|
|
const blog = defineCollection({
|
|
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/blog' }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
title: z.string(),
|
|
description: z.string().optional(),
|
|
date: z.coerce.date(),
|
|
updatedDate: z.coerce.date().optional(),
|
|
coverImage: image().optional(),
|
|
tags: z.string().array().default([]),
|
|
}),
|
|
})
|
|
|
|
const page = defineCollection({
|
|
loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/page' }),
|
|
schema: z.object({
|
|
title: z.string(),
|
|
date: z.coerce.date(),
|
|
}),
|
|
})
|
|
|
|
export const collections = { blog, page } |