generated from nhcarrigan/template
feat: set up announcements page
This commit is contained in:
23
src/app/post/[slug]/page.tsx
Normal file
23
src/app/post/[slug]/page.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
import { Rule } from "@/components/rule";
|
||||
import { getPostData } from "@/lib/posts";
|
||||
import Markdown from "react-markdown";
|
||||
import remarkGfm from "remark-gfm";
|
||||
|
||||
export default async function Page({
|
||||
params
|
||||
}: {
|
||||
params: Promise<{slug: string}>
|
||||
}) {
|
||||
const { slug } = await params;
|
||||
const post = getPostData(slug);
|
||||
return (
|
||||
<main>
|
||||
<h1>{post.data.title}</h1>
|
||||
<p className="italic text-center">{`Published ${post.data.date.toLocaleDateString("en-GB", { weekday: "long", year: "numeric", month: "long", day: "numeric"})}`}</p>
|
||||
<Rule />
|
||||
<Markdown remarkPlugins={[remarkGfm]}>{post.content}</Markdown>
|
||||
<Rule />
|
||||
<a href="/">{"← Back to home"}</a>
|
||||
</main>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user