25 lines
707 B
TypeScript
25 lines
707 B
TypeScript
import { defineCollection } from 'astro:content';
|
|
import { z } from 'astro/zod';
|
|
import { glob } from 'astro/loaders';
|
|
|
|
const insights = defineCollection({
|
|
loader: glob({ pattern: '**/*.md', base: './src/content/insights' }),
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
title: z.string(),
|
|
subtitle: z.string().optional(),
|
|
description: z.string(),
|
|
date: z.coerce.date(),
|
|
lang: z.enum(['en', 'de']),
|
|
category: z.string(),
|
|
readingTime: z.number().int().positive(),
|
|
author: z.string(),
|
|
authorRole: z.string(),
|
|
cover: image(),
|
|
coverAlt: z.string(),
|
|
tags: z.array(z.string()).default([]),
|
|
}),
|
|
});
|
|
|
|
export const collections = { insights };
|