From f100d259d2ffebe61fef56ea3964f6d534d598c8 Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Thu, 3 Jul 2025 13:46:07 +0300 Subject: Initial pleroma pull support --- src/pages/micro/rss.xml.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/pages/micro/rss.xml.ts') diff --git a/src/pages/micro/rss.xml.ts b/src/pages/micro/rss.xml.ts index 7311319..0827ccb 100644 --- a/src/pages/micro/rss.xml.ts +++ b/src/pages/micro/rss.xml.ts @@ -1,18 +1,28 @@ import { getCollection } from "astro:content"; -import { siteConfig } from "@/site.config"; import rss from "@astrojs/rss"; +import { siteConfig } from "@/site.config"; export const GET = async () => { - const micro = await getCollection("note"); + // Get both local notes and Pleroma posts + const [allNotes, allMicro] = await Promise.all([ + getCollection("note"), + getCollection("micro").catch(() => []), // Fallback to empty array if micro collection fails + ]); + + // Combine and sort all micro posts + const allMicroPosts = [...allNotes, ...allMicro].sort( + (a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime(), + ); return rss({ title: siteConfig.title, description: siteConfig.description, site: import.meta.env.SITE, - items: micro.map((note) => ({ - title: note.data.title, - pubDate: note.data.publishDate, - link: `micro/${note.id}/`, + items: allMicroPosts.map((post) => ({ + title: post.data.title, + pubDate: post.data.publishDate, + link: `micro/${post.id}/`, + description: post.data.description, })), }); }; -- cgit v1.2.3