summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2026-01-13 17:13:43 +0100
committerDawid Rycerz <dawid@rycerz.xyz>2026-01-13 17:20:15 +0100
commit9fe4480c3981c38ae8e24d0495df957039864a5d (patch)
treea5f3e4f8c0732c8cd934c28596c6a4d0ab38a4b4 /src/utils
parentc0dcecc43e36eeb6b10f662c1be760736cd0dbac (diff)
Remove micro and migrate to use only posts
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/date.ts5
-rw-r--r--src/utils/micro.ts40
2 files changed, 1 insertions, 44 deletions
diff --git a/src/utils/date.ts b/src/utils/date.ts
index b8c0376..314a837 100644
--- a/src/utils/date.ts
+++ b/src/utils/date.ts
@@ -15,9 +15,6 @@ export function getFormattedDate(
}).format(date);
}
-export function collectionDateSort(
- a: CollectionEntry<"post" | "micro">,
- b: CollectionEntry<"post" | "micro">,
-) {
+export function collectionDateSort(a: CollectionEntry<"post">, b: CollectionEntry<"post">) {
return b.data.publishDate.getTime() - a.data.publishDate.getTime();
}
diff --git a/src/utils/micro.ts b/src/utils/micro.ts
deleted file mode 100644
index 7f06b41..0000000
--- a/src/utils/micro.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-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 [];
- }
-}
-
-/** Extract all tags from micro posts */
-export function getAllMicroTags(entries: MicroEntry[]): string[] {
- return entries.flatMap((entry) => entry.data.tags ?? []);
-}
-
-/** Get unique tags from micro posts */
-export function getUniqueMicroTags(entries: MicroEntry[]): string[] {
- return [...new Set(getAllMicroTags(entries))];
-}
-
-/** Get unique tags with counts from micro posts */
-export function getUniqueMicroTagsWithCount(entries: MicroEntry[]): [string, number][] {
- return [
- ...getAllMicroTags(entries).reduce(
- (acc, t) => acc.set(t, (acc.get(t) ?? 0) + 1),
- new Map<string, number>(),
- ),
- ].sort((a, b) => b[1] - a[1]);
-}