From 9fe4480c3981c38ae8e24d0495df957039864a5d Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Tue, 13 Jan 2026 17:13:43 +0100 Subject: Remove micro and migrate to use only posts --- src/data/post.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/data/post.ts') diff --git a/src/data/post.ts b/src/data/post.ts index 7cadb93..85cc0d0 100644 --- a/src/data/post.ts +++ b/src/data/post.ts @@ -1,16 +1,18 @@ import { type CollectionEntry, getCollection } from "astro:content"; -/** filter out draft posts based on the environment and optionally archived posts and micro posts */ -export async function getAllPosts( - includeArchived = false, - includeMicro = false, -): Promise[]> { - return await getCollection("post", ({ data }) => { +/** filter out draft posts based on the environment and optionally archived posts */ +export async function getAllPosts(includeArchived = false): Promise[]> { + const posts = await getCollection("post", ({ data }) => { const isDraftFilter = import.meta.env.PROD ? !data.draft : true; const isArchivedFilter = includeArchived || !data.tags.includes("archived"); - const isMicroFilter = includeMicro || !data.tags.includes("micro"); - return isDraftFilter && isArchivedFilter && isMicroFilter; + return isDraftFilter && isArchivedFilter; }); + + // Fetch pleroma posts and cast them to post type since schemas are now compatible + const pleromaPosts = await getCollection("pleroma").catch(() => []); + const pleromaAsPost = pleromaPosts as unknown as CollectionEntry<"post">[]; + + return [...posts, ...pleromaAsPost]; } /** Get tag metadata by tag name */ -- cgit v1.2.3