From c0dcecc43e36eeb6b10f662c1be760736cd0dbac Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Tue, 13 Jan 2026 15:44:43 +0100 Subject: Cleanup old micro pages --- src/pages/micro/rss.xml.ts | 59 ---------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 src/pages/micro/rss.xml.ts (limited to 'src/pages/micro/rss.xml.ts') diff --git a/src/pages/micro/rss.xml.ts b/src/pages/micro/rss.xml.ts deleted file mode 100644 index 9356341..0000000 --- a/src/pages/micro/rss.xml.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { getCollection } from "astro:content"; -import rss from "@astrojs/rss"; -import type { APIContext } from "astro"; -import { siteConfig } from "@/site.config"; - -export const GET = async (context: APIContext) => { - // Get only Pleroma posts tagged with "micro" - const allMicro = await getCollection("micro", ({ data }) => data.tags?.includes("micro")).catch( - () => [], - ); // Fallback to empty array if micro collection fails - - // Sort all micro posts - const allMicroPosts = allMicro.sort( - (a, b) => b.data.publishDate.getTime() - a.data.publishDate.getTime(), - ); - - // Generate RSS items with full content and images - const items = allMicroPosts.map((post) => { - // Get the pre-rendered HTML from the post - let fullContent = post.rendered?.html || post.body || ""; - - // Append images if available - if (post.data.attachments && post.data.attachments.length > 0) { - const imagesHtml = post.data.attachments - .map( - (att) => - `

${att.alt ||

`, - ) - .join(""); - fullContent += imagesHtml; - } - - // Build author customData for RSS - let authorCustomData = ""; - if (post.data.author) { - const authorName = post.data.author.displayName || post.data.author.username; - authorCustomData = `${authorName}${authorName}`; - } - - return { - title: post.data.title, - pubDate: post.data.publishDate, - link: `micro/${post.id}/`, - description: post.data.description, - content: fullContent, - customData: authorCustomData, - }; - }); - - const site = context.site || import.meta.env.SITE; - - return rss({ - title: siteConfig.title, - description: siteConfig.description, - site, - items, - customData: ``, - }); -}; -- cgit v1.2.3