feat: add a friend link (blogroll) shortcode

This commit is contained in:
grassblock 2025-05-16 21:34:02 +08:00
parent 6a2d5fd912
commit de4de10703
6 changed files with 54 additions and 13 deletions

View file

@ -1,17 +1,28 @@
import { defineCollection } from 'astro:content';
import { posts } from './posts/_schemas';
import { pages } from "./pages/_schemas";
import {defineCollection} from 'astro:content';
import {posts} from './posts/_schemas';
import {pages} from "./pages/_schemas";
import {file} from 'astro/loaders';
import { z } from 'astro:content';
const blogCollection = defineCollection({
type: 'content',
schema: posts,
type: 'content',
schema: posts,
});
const pageCollection = defineCollection({
type: 'content',
schema: pages,
});
const blogRollData = defineCollection({
loader: file("src/data/links.yaml"),
schema: z.object({
link: z.string(),
avatar: z.string().optional(),
description: z.string().optional(),
})
});
export const collections = {
'posts': blogCollection,
'pages': pageCollection,
'posts': blogCollection,
'pages': pageCollection,
'links': blogRollData,
};