summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2026-01-13 15:44:43 +0100
committerDawid Rycerz <dawid@rycerz.xyz>2026-01-13 15:44:43 +0100
commitc0dcecc43e36eeb6b10f662c1be760736cd0dbac (patch)
tree9c421dc980a3e011f0bb4671e90b0d8a38ef614d /src/pages
parent52411f6cb9efc10dd683096b34e5c279a11f7e0a (diff)
Cleanup old micro pages
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/index.astro2
-rw-r--r--src/pages/micro/[...page].astro77
-rw-r--r--src/pages/micro/rss.xml.ts59
3 files changed, 1 insertions, 137 deletions
diff --git a/src/pages/index.astro b/src/pages/index.astro
index df7a66a..1bc088c 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -49,7 +49,7 @@ const latestMicro = allMicro.sort(collectionDateSort).slice(0, MAX_MICRO);
latestMicro.length > 0 && (
<section class="mt-16">
<h2 class="title text-accent mb-6 text-xl">
- <a href="/micro/">Micro</a>
+ <a href="/tags/micro/">Micro</a>
</h2>
<ul class="space-y-6" role="list">
{latestMicro.map((note) => (
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<CollectionEntry<"micro">>;
- 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,
- },
- }),
-};
----
-
-<PageLayout meta={meta}>
- <section>
- <h1 class="title mb-6 flex items-center gap-3">
- Micro
- <a class="text-accent" href="/tags/" title="Browse all tags">
- <span class="sr-only">Browse tags</span>
- <Icon aria-hidden="true" class="h-6 w-6" focusable="false" name="mdi:tag-multiple" />
- </a>
- <a class="text-accent" href="/tags/micro/rss.xml" target="_blank">
- <span class="sr-only">RSS feed</span>
- <Icon aria-hidden="true" class="h-6 w-6" focusable="false" name="mdi:rss" />
- </a>
- </h1>
- <ul class="mt-6 space-y-8 text-start">
- {
- page.data.map((note) => (
- <li class="">
- <Note note={note} as="h2" isPreview />
- </li>
- ))
- }
- </ul>
- <Pagination {...paginationProps} />
- </section>
-</PageLayout>
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) =>
- `<p><img src="${att.url}" alt="${att.alt || "Image"}" style="max-width: 100%; height: auto;" /></p>`,
- )
- .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 = `<author>${authorName}</author><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">${authorName}</dc:creator>`;
- }
-
- 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: `<atom:link href="${site}micro/rss.xml" rel="self" type="application/rss+xml" xmlns:atom="http://www.w3.org/2005/Atom" />`,
- });
-};