// SPDX-FileCopyrightText: 2025 Norbert Melzer // SPDX-FileContributor: Norbert Melzer // // SPDX-License-Identifier: MIT import { getCollection, type CollectionEntry } from "astro:content"; export type Author = CollectionEntry<"authors">; export type WithPosts = T & { posts: CollectionEntry<"blog">[]; }; export const withPosts = async ( author: T, ): Promise> => { const posts = await getCollection( "blog", ({ data: { author: postAuthor } }) => author.slug == postAuthor.slug, ); return { ...author, posts }; };