Skip to content

Commit d6bbe62

Browse files
committed
feat: json-ld
1 parent 0e7b9b1 commit d6bbe62

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

src/app/(app)/notes/[nid]/page.tsx

+29-6
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,35 @@ export default async function Page({ params }: { params: Record<string, any> })
6565
const lang = getUserLocale();
6666

6767
return (
68-
<PageTransition>
69-
<PaperLayout>
70-
<PageInner postData={postData} />
71-
</PaperLayout>
72-
<Gisus lang={lang} />
73-
</PageTransition>
68+
<>
69+
<PageTransition>
70+
<PaperLayout>
71+
<PageInner postData={postData} />
72+
</PaperLayout>
73+
<Gisus lang={lang} />
74+
</PageTransition>
75+
<script
76+
type="application/ld+json"
77+
dangerouslySetInnerHTML={{
78+
__html: JSON.stringify({
79+
'@context': 'https://schema.org',
80+
'@type': 'BlogPosting',
81+
headline: postData.title,
82+
description: postData.summary,
83+
datePublished: postData.createdAt,
84+
dateModified: postData.updatedAt,
85+
author: postData.authors?.map((name) => ({
86+
'@type': 'Person',
87+
name,
88+
})),
89+
mainEntityOfPage: {
90+
'@type': 'WebPage',
91+
'@id': `https://your-domain.com/notes/${nid}`,
92+
},
93+
}),
94+
}}
95+
/>
96+
</>
7497
);
7598
}
7699

0 commit comments

Comments
 (0)