diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-03 13:59:59 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-03 13:59:59 +0300 |
| commit | 4b9018b6d92ef8f1854d9dc44625295c2acd3fb3 (patch) | |
| tree | 10e01ec849c7439befd0a21f04021213e98d0f94 /src/utils/micro.ts | |
| parent | f100d259d2ffebe61fef56ea3964f6d534d598c8 (diff) | |
Cleanup old notes feature
Diffstat (limited to 'src/utils/micro.ts')
| -rw-r--r-- | src/utils/micro.ts | 16 |
1 files changed, 5 insertions, 11 deletions
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 []; } } |
