Drive archive posts from content
This commit is contained in:
parent
d74495ddef
commit
b4025aecaf
4 changed files with 276 additions and 2 deletions
24
src/content.config.ts
Normal file
24
src/content.config.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { defineCollection } from "astro:content";
|
||||
import { glob } from "astro/loaders";
|
||||
import { z } from "astro/zod";
|
||||
|
||||
const archive = defineCollection({
|
||||
loader: glob({
|
||||
base: "./content",
|
||||
pattern: ["blog/**/*.md", "speeches/**/*.md"],
|
||||
generateId: ({ entry }) => entry.replace(/\.md$/, ""),
|
||||
}),
|
||||
schema: z.object({
|
||||
title: z.string().optional(),
|
||||
type: z.enum(["blog", "speech"]).optional(),
|
||||
published: z.string().optional(),
|
||||
updated: z.string().optional(),
|
||||
source: z.string().optional(),
|
||||
speechYear: z.string().optional(),
|
||||
speechCollection: z.string().optional(),
|
||||
categories: z.array(z.string()).optional().default([]),
|
||||
tags: z.array(z.string()).optional().default([]),
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = { archive };
|
||||
Loading…
Add table
Add a link
Reference in a new issue