import Link from "next/link"; import { getPostData, getAllPostIds } from "@/lib/posts"; import type { PostData } from "@/lib/posts"; import Window from "@/components/window"; import TableOfContents from "@/components/table-of-contents"; import { MDXRemote } from "next-mdx-remote/rsc"; import rehypePrettyCode from "rehype-pretty-code"; import rehypeSlug from "rehype-slug"; interface PageProps { params: { slug: string; }; } export async function generateStaticParams() { const paths = getAllPostIds(); return paths.map((path) => ({ slug: path.params.slug })); } export async function generateMetadata({ params }: PageProps) { const postData = await getPostData(params.slug); return { title: `${postData.title} | Gabriel's Kaszewski Blog`, }; } export default async function Post({ params }: PageProps) { const postData: PostData = await getPostData(params.slug); return (
{new Date(postData.date).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", })} {postData.readingTime}
{postData.wip && (
🚧 This post is a work in progress — content may change.
)} {/* Mobile TOC — shown above article, hidden on lg+ */} {postData.headings.length > 0 && (
)}
{/* Desktop TOC sidebar — hidden on mobile */} {postData.headings.length > 0 && (
)}
← Back to home
); }