summaryrefslogtreecommitdiff
path: root/src/data/post.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/post.ts')
-rw-r--r--src/data/post.ts18
1 files changed, 10 insertions, 8 deletions
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<CollectionEntry<"post">[]> {
- return await getCollection("post", ({ data }) => {
+/** filter out draft posts based on the environment and optionally archived posts */
+export async function getAllPosts(includeArchived = false): Promise<CollectionEntry<"post">[]> {
+ 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 */