blob: 51d336bd1d63f36b8c17e2bba86560f6140e7bd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import type { CollectionEntry } from "astro:content";
export type MicroEntry = CollectionEntry<"micro">;
export function sortMicroEntries(entries: MicroEntry[]): MicroEntry[] {
return entries.sort((a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime());
}
export async function getAllMicroPosts(): Promise<MicroEntry[]> {
const { getCollection } = await import("astro:content");
// Get only Pleroma micro posts
try {
const microPosts = await getCollection("micro");
return sortMicroEntries(microPosts);
} catch (error) {
console.warn("Micro collection not available:", error);
return [];
}
}
|