feat: extracts some repeated logic out into lib/ files
This commit is contained in:
parent
38653f2aa1
commit
99c1539aad
22 changed files with 200 additions and 336 deletions
|
|
@ -3,15 +3,14 @@ import { glob, file } from 'astro/loaders';
|
|||
import { z } from 'astro/zod';
|
||||
import yaml from 'js-yaml';
|
||||
|
||||
const posts = defineCollection({
|
||||
loader: glob({ pattern: '**/*.md', base: './src/content/posts' }),
|
||||
const md = defineCollection({
|
||||
loader: glob({ pattern: '**/*.md', base: './src/content/md' }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
date: z.coerce.date(),
|
||||
pinned: z.boolean().optional(),
|
||||
category: z.string().optional(),
|
||||
draft: z.boolean().optional(),
|
||||
slug: z.string(),
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -29,4 +28,4 @@ const bookmarks = defineCollection({
|
|||
})
|
||||
});
|
||||
|
||||
export const collections = { posts, bookmarks };
|
||||
export const collections = { md, bookmarks };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue