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/[...page].astro | 77 ----------------------------------------- src/pages/micro/rss.xml.ts | 59 ------------------------------- 2 files changed, 136 deletions(-) delete mode 100644 src/pages/micro/[...page].astro delete mode 100644 src/pages/micro/rss.xml.ts (limited to 'src/pages/micro') diff --git a/src/pages/micro/[...page].astro b/src/pages/micro/[...page].astro deleted file mode 100644 index d11d9ce..0000000 --- a/src/pages/micro/[...page].astro +++ /dev/null @@ -1,77 +0,0 @@ ---- -import { type CollectionEntry, getCollection } from "astro:content"; -import type { GetStaticPaths, Page } from "astro"; -import { Icon } from "astro-icon/components"; -import Note from "@/components/note/Note.astro"; -import Pagination from "@/components/Paginator.astro"; -import PageLayout from "@/layouts/Base.astro"; - -export const getStaticPaths = (async ({ paginate }) => { - const MAX_MICRO_PER_PAGE = 10; - - // 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(), - ); - - return paginate(allMicroPosts, { pageSize: MAX_MICRO_PER_PAGE }); -}) satisfies GetStaticPaths; - -interface Props { - page: Page>; - uniqueTags: string[]; -} - -const { page } = Astro.props; - -const meta = { - description: "Read my collection of micro posts", - title: "Micro", -}; - -const paginationProps = { - ...(page.url.prev && { - prevUrl: { - text: "← Previous Page", - url: page.url.prev, - }, - }), - ...(page.url.next && { - nextUrl: { - text: "Next Page →", - url: page.url.next, - }, - }), -}; ---- - - -
-

- Micro - - Browse tags - - - RSS feed - -

-
    - { - page.data.map((note) => ( -
  • - -
  • - )) - } -
- -
-
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