From 3ba85e5191f816136e8bdb0e0b1356eb55e4df48 Mon Sep 17 00:00:00 2001 From: Chris Arter Date: Fri, 8 May 2026 12:33:55 -0400 Subject: [PATCH] feat(frontend): port /tags index and detail Co-Authored-By: Claude Opus 4.7 (1M context) --- src/app/(frontend)/tags/[slug]/page.tsx | 22 +++++++++++++++++++++ src/app/(frontend)/tags/page.tsx | 26 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/app/(frontend)/tags/[slug]/page.tsx create mode 100644 src/app/(frontend)/tags/page.tsx diff --git a/src/app/(frontend)/tags/[slug]/page.tsx b/src/app/(frontend)/tags/[slug]/page.tsx new file mode 100644 index 0000000..0cd8ebb --- /dev/null +++ b/src/app/(frontend)/tags/[slug]/page.tsx @@ -0,0 +1,22 @@ +import { notFound } from 'next/navigation' +import { listPosts, listAllTags } from '@/lib/posts' +import { PostList } from '@/components/PostList' + +export const revalidate = 60 + +export async function generateStaticParams() { + const tags = await listAllTags() + return tags.map(({ tag }) => ({ slug: tag.slug })) +} + +export default async function TagPage({ params }: { params: Promise<{ slug: string }> }) { + const { slug } = await params + const r = await listPosts({ tag: slug, limit: 0 }) + if (r.docs.length === 0) notFound() + return ( +
+

#{slug}

+ r.totalDocs - i)} /> +
+ ) +} diff --git a/src/app/(frontend)/tags/page.tsx b/src/app/(frontend)/tags/page.tsx new file mode 100644 index 0000000..caf6b74 --- /dev/null +++ b/src/app/(frontend)/tags/page.tsx @@ -0,0 +1,26 @@ +import Link from 'next/link' +import { listAllTags } from '@/lib/posts' + +export const revalidate = 60 + +export default async function TagsPage() { + const tags = await listAllTags() + tags.sort((a, b) => b.count - a.count) + return ( +
+

Tags

+
    + {tags.map(({ tag, count }) => ( +
  • + + {tag.name} + + {count} post{count === 1 ? '' : 's'} + + +
  • + ))} +
+
+ ) +} -- 2.51.2