37 lines
949 B
TypeScript
37 lines
949 B
TypeScript
import { notFound } from 'next/navigation'
|
|
|
|
import { getBlogPostBySlug } from '@/lib/notion/content/blogPosts'
|
|
import getProxiedAssetUrl from '@/lib/notion/utils/getProxiedAssetUrl'
|
|
import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText'
|
|
|
|
const Head = async ({ params: { slug } }: { params: { slug: string } }) => {
|
|
const blogPost = await getBlogPostBySlug({ slug })
|
|
|
|
if (!blogPost) {
|
|
notFound()
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<title>{`${richTextAsPlainText(
|
|
blogPost.properties.Name.title,
|
|
)} - Spencer Sharp`}</title>
|
|
<meta
|
|
name="description"
|
|
content={richTextAsPlainText(
|
|
blogPost.properties.MetaDescription.rich_text,
|
|
)}
|
|
/>
|
|
<meta
|
|
name="og:image"
|
|
content={`https://filipesm.eu${getProxiedAssetUrl({
|
|
pageId: blogPost.id,
|
|
lastEditedTime: blogPost.last_edited_time,
|
|
})}`}
|
|
/>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Head
|