28 lines
1.0 KiB
JavaScript
28 lines
1.0 KiB
JavaScript
import { defineCollection } from 'astro:content';
|
|
import { glob, file } from 'astro/loaders';
|
|
import { z } from 'astro/zod';
|
|
|
|
const news = defineCollection({
|
|
loader: glob({ pattern: "**/*.md", base: "./src/content/news" }),
|
|
schema: ({ image }) => z.object({
|
|
locale: z.string().describe("News main language"),
|
|
title: z.string(),
|
|
date: z.date(),
|
|
draft: z.boolean().optional(),
|
|
place: z.string().optional(),
|
|
order: z.number().optional(),
|
|
city: z.string().optional(),
|
|
state: z.string().optional(),
|
|
country: z.string().optional(),
|
|
thumbnail: image().optional().describe("Main news thumbnail image"),
|
|
youtube: z.string().optional(),
|
|
tags: z.array(z.string()).optional().describe("News tags"),
|
|
gallery: z.array(z.object({
|
|
image: image().optional(),
|
|
text: z.string().optional(),
|
|
text_alt: z.string().optional(),
|
|
})).optional().nullable()
|
|
}),
|
|
});
|
|
|
|
export const collections = { news }; |