Add Markdown blog and FAQ content collections
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { defineCollection, z } from 'astro:content';
|
||||
import { glob } from 'astro/loaders';
|
||||
|
||||
const blog = defineCollection({
|
||||
loader: glob({ base: './sites/blog/content/posts', pattern: '**/*.md' }),
|
||||
schema: z.object({
|
||||
title: z.string().min(12).max(100),
|
||||
description: z.string().min(30).max(180),
|
||||
pubDate: z.coerce.date(),
|
||||
updatedDate: z.coerce.date().optional(),
|
||||
tags: z.array(z.string().min(2).max(32)).min(1).max(4),
|
||||
draft: z.boolean().default(false),
|
||||
}),
|
||||
});
|
||||
|
||||
const faq = defineCollection({
|
||||
loader: glob({ base: './sites/www/content/faq', pattern: '**/*.md' }),
|
||||
schema: z.object({
|
||||
question: z.string().min(12).max(180),
|
||||
category: z.string().min(2).max(48).default('General'),
|
||||
order: z.number().int().min(0).max(99).default(0),
|
||||
draft: z.boolean().default(false),
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = { blog, faq };
|
||||
Reference in New Issue
Block a user