feat: multi-authors support

This commit is contained in:
grassblock 2025-05-23 22:03:54 +08:00
parent af55568839
commit 458dc2dafe
9 changed files with 54 additions and 8 deletions

View file

@ -3,6 +3,7 @@ import {posts} from './posts/_schemas';
import {pages} from "./pages/_schemas";
import {file} from 'astro/loaders';
import { z } from 'astro:content';
import {siteConfig} from "../config.ts";
const blogCollection = defineCollection({
type: 'content',
@ -21,8 +22,21 @@ const blogRollData = defineCollection({
})
});
const authorsData = defineCollection({
loader: file("src/data/authors.yaml"),
schema: z.object({
name: z.string().default(siteConfig.defaultAuthor.name),
email: z.string().email().default(siteConfig.defaultAuthor.email),
social: z.object({
twitter: z.string().optional(),
fediverse: z.string().optional(),
}).optional(),
})
});
export const collections = {
'posts': blogCollection,
'pages': pageCollection,
'links': blogRollData,
'authors': authorsData,
};

View file

@ -6,4 +6,5 @@ export const posts = ({ image }) => z.object({
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
cover: image().optional(),
author: z.string().optional(),
});

View file

@ -2,6 +2,7 @@
title: 'The Art of Minimalism'
description: 'Thoughts on minimalism in design and code'
pubDate: '2025-06-05'
author: 'Wheatley'
---
Minimalism isn't just about having less, it's about making room for what matters.