feat(blog): add file-based blog with dynamic slugs, MDX content and layout shell
- Introduced blog routing using Next.js App Router - Implemented dynamic [slug] pages for blog posts - Added MDX-based content loading via lib/posts - Integrated shared TopBar layout with navigation - Established clear content, lib and component separation
This commit is contained in:
44
apps/public-web/app/(site)/blog/page.tsx
Normal file
44
apps/public-web/app/(site)/blog/page.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import Link from "next/link";
|
||||
import { TopBar, BackLink, InfoLink } from "../../../components/shell/TopBar";
|
||||
import { getAllPosts } from "../../../lib/posts";
|
||||
|
||||
export default function BlogIndexPage() {
|
||||
const posts = getAllPosts();
|
||||
|
||||
return (
|
||||
<div>
|
||||
<TopBar
|
||||
title="Blog"
|
||||
left={<BackLink href="/" />}
|
||||
right={<InfoLink href="/about" />}
|
||||
/>
|
||||
|
||||
<main className="mx-auto max-w-3xl px-4 py-10">
|
||||
<div className="space-y-6">
|
||||
{posts.map((p) => (
|
||||
<article
|
||||
key={p.slug}
|
||||
className="border border-black/10 p-4"
|
||||
>
|
||||
<div className="text-xs opacity-70">
|
||||
{p.meta.date}
|
||||
</div>
|
||||
|
||||
<h2 className="text-lg font-semibold">
|
||||
<Link href={`/blog/${p.slug}`}>
|
||||
{p.meta.title}
|
||||
</Link>
|
||||
</h2>
|
||||
|
||||
{p.meta.excerpt ? (
|
||||
<p className="mt-2 opacity-80">
|
||||
{p.meta.excerpt}
|
||||
</p>
|
||||
) : null}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user