Mirror of the sourcecode for my blog, original repo: https://github.com/NobbZ/blog-nobbz-dev
Something went wrong. Try again.
123456789101112131415161718192021222324// 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 extends Author> = T & { posts: CollectionEntry<"blog">[];};
export const withPosts = async <T extends Author>( author: T,): Promise<WithPosts<T>> => { const posts = await getCollection( "blog", ({ data: { author: postAuthor } }) => author.slug == postAuthor.slug, );
return { ...author, posts };};