You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { notFound } from 'next/navigation'
|
|
|
|
import Markdown from 'markdown-to-jsx'
|
|
|
|
|
|
|
|
import InfoBar from '~/components/InfoBar'
|
|
|
|
import { getPostSlugs, loadSinglePage } from '~/utils/post'
|
|
|
|
|
|
|
|
export async function generateStaticParams() {
|
|
|
|
const slugs = await getPostSlugs()
|
|
|
|
return slugs.map((slug: string) => ({ slug }))
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function Post({ params: { slug } }) {
|
|
|
|
const post = await loadSinglePage(slug)
|
|
|
|
if (!post) notFound()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<h1 className="pageTitle">
|
|
|
|
{post.title}
|
|
|
|
</h1>
|
|
|
|
<main className="mainColumn card">
|
|
|
|
<InfoBar authorName={post.author} publishedDate={post.date} />
|
|
|
|
<Markdown>{post.body}</Markdown>
|
|
|
|
</main>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|