mirror of
https://github.com/theoludwig/theoludwig.git
synced 2024-11-05 13:01:30 +01:00
45 lines
937 B
TypeScript
45 lines
937 B
TypeScript
import type { Metadata } from "next"
|
|
import { notFound } from "next/navigation"
|
|
|
|
import "katex/dist/katex.min.css"
|
|
|
|
import { getBlogPostBySlug } from "@/blog/blog"
|
|
import { BlogPost } from "@/blog/BlogPost"
|
|
|
|
interface BlogPostPageProps {
|
|
params: {
|
|
slug: string
|
|
}
|
|
}
|
|
|
|
export const generateMetadata = async (
|
|
props: BlogPostPageProps,
|
|
): Promise<Metadata> => {
|
|
const blogPost = await getBlogPostBySlug(props.params.slug)
|
|
if (blogPost == null) {
|
|
return notFound()
|
|
}
|
|
const title = `${blogPost.frontmatter.title} | Théo LUDWIG`
|
|
const description = blogPost.frontmatter.description
|
|
return {
|
|
title,
|
|
description,
|
|
openGraph: {
|
|
title,
|
|
description,
|
|
},
|
|
twitter: {
|
|
title,
|
|
description,
|
|
},
|
|
}
|
|
}
|
|
|
|
const BlogPostPage = async (props: BlogPostPageProps): Promise<JSX.Element> => {
|
|
const { params } = props
|
|
|
|
return <BlogPost slug={params.slug} />
|
|
}
|
|
|
|
export default BlogPostPage
|