diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/date.ts | 4 | ||||
| -rw-r--r-- | src/utils/micro.ts | 16 |
2 files changed, 7 insertions, 13 deletions
diff --git a/src/utils/date.ts b/src/utils/date.ts index b919810..b8c0376 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -16,8 +16,8 @@ export function getFormattedDate( } export function collectionDateSort( - a: CollectionEntry<"post" | "note" | "micro">, - b: CollectionEntry<"post" | "note" | "micro">, + a: CollectionEntry<"post" | "micro">, + b: CollectionEntry<"post" | "micro">, ) { return b.data.publishDate.getTime() - a.data.publishDate.getTime(); } diff --git a/src/utils/micro.ts b/src/utils/micro.ts index 7344850..51d336b 100644 --- a/src/utils/micro.ts +++ b/src/utils/micro.ts @@ -1,6 +1,6 @@ import type { CollectionEntry } from "astro:content"; -export type MicroEntry = CollectionEntry<"note">; +export type MicroEntry = CollectionEntry<"micro">; export function sortMicroEntries(entries: MicroEntry[]): MicroEntry[] { return entries.sort((a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime()); @@ -9,18 +9,12 @@ export function sortMicroEntries(entries: MicroEntry[]): MicroEntry[] { export async function getAllMicroPosts(): Promise<MicroEntry[]> { const { getCollection } = await import("astro:content"); - const notes = await getCollection("note"); - - // Try to get micro posts if available, otherwise just use notes + // Get only Pleroma micro posts try { const microPosts = await getCollection("micro"); - const allMicroPosts: (CollectionEntry<"note"> | CollectionEntry<"micro">)[] = [ - ...notes, - ...microPosts, - ]; - return sortMicroEntries(allMicroPosts as MicroEntry[]); + return sortMicroEntries(microPosts); } catch (error) { - console.warn("Micro collection not available, using notes only:", error); - return sortMicroEntries(notes); + console.warn("Micro collection not available:", error); + return []; } } |
