This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import { defineCollection } from 'astro:content';
|
||||
import { glob } from 'astro/loaders';
|
||||
import { z } from 'astro/zod';
|
||||
|
||||
const status = z.enum(['developing', 'disputed', 'resolved', 'historical']);
|
||||
|
||||
const maintenance = {
|
||||
author: z.string().default('Ana'),
|
||||
maintainers: z.array(z.string()).default(['Ana']),
|
||||
reviewed: z.coerce.date(),
|
||||
status: status.default('developing'),
|
||||
draft: z.boolean().default(false),
|
||||
};
|
||||
|
||||
const stories = defineCollection({
|
||||
loader: glob({ base: './src/content/stories', pattern: '**/*.md' }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
published: z.coerce.date(),
|
||||
featured: z.boolean().default(false),
|
||||
tags: z.array(z.string()).default([]),
|
||||
image: z.string().optional(),
|
||||
imageAlt: z.string().optional(),
|
||||
trustPattern: z
|
||||
.object({
|
||||
claim: z.string(),
|
||||
trusted: z.string(),
|
||||
failure: z.string(),
|
||||
})
|
||||
.optional(),
|
||||
...maintenance,
|
||||
}),
|
||||
});
|
||||
|
||||
const briefings = defineCollection({
|
||||
loader: glob({ base: './src/content/briefings', pattern: '**/*.md' }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
issue: z.number().int().nonnegative(),
|
||||
published: z.coerce.date(),
|
||||
...maintenance,
|
||||
}),
|
||||
});
|
||||
|
||||
const guides = defineCollection({
|
||||
loader: glob({ base: './src/content/guides', pattern: '**/*.md' }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
firstPublished: z.coerce.date(),
|
||||
tags: z.array(z.string()).default([]),
|
||||
...maintenance,
|
||||
}),
|
||||
});
|
||||
|
||||
const episodes = defineCollection({
|
||||
loader: glob({ base: './src/content/episodes', pattern: '**/*.md' }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
episode: z.number().int().positive(),
|
||||
published: z.coerce.date(),
|
||||
duration: z.string().optional(),
|
||||
audioUrl: z.url().optional(),
|
||||
guests: z.array(z.string()).default([]),
|
||||
...maintenance,
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = { stories, briefings, guides, episodes };
|
||||
Reference in New Issue
Block a user