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 ( +