@@ -8,7 +8,8 @@ import Giscus from '@/components/Giscus';
88import { HomeIcon } from '@/components/icons' ;
99import TableOfContent from '@/components/TableOfContent' ;
1010import ZoomableImage from '@/components/ZoomableImage' ;
11- import { allBlogPosts , parseToc } from '@/libs/post' ;
11+ import { allBlogPosts , contentToDescription , parseToc } from '@/libs/post' ;
12+ import { getPostJsonLD } from '@/libs/seo' ;
1213
1314interface PostPageProps {
1415 params : {
@@ -26,10 +27,10 @@ export async function generateMetadata({ params }: PostPageProps): Promise<Metad
2627 const post = allBlogPosts . find ( ( post ) => post . slug === `/${ params . slug } ` ) ;
2728
2829 if ( ! post ) return { } ;
29-
30+ const description = contentToDescription ( post . body . raw ) ;
3031 return {
3132 title : `${ post . title } | yuhwan park's blog` ,
32- description : post . title ,
33+ description,
3334 alternates : {
3435 canonical : `https://yuhwan-park.github.io${ post . slug } ` ,
3536 } ,
@@ -45,7 +46,7 @@ export async function generateMetadata({ params }: PostPageProps): Promise<Metad
4546 authors : [ 'yuhwan park' ] ,
4647 title : post . title ,
4748 url : `https://yuhwan-park.github.io${ post . slug } ` ,
48- description : post . title ,
49+ description,
4950 } ,
5051 } ;
5152}
@@ -66,6 +67,10 @@ export default function PostPage({ params }: PostPageProps) {
6667
6768 return (
6869 < main >
70+ < script
71+ type = "application/ld+json"
72+ dangerouslySetInnerHTML = { { __html : JSON . stringify ( getPostJsonLD ( post ) ) } }
73+ />
6974 < div className = "blur-layer" aria-hidden />
7075 < TableOfContent data-animate className = "px-2 text-sm" toc = { toc } />
7176 < div data-animate >
0 commit comments