Skip to content

Commit 3b004dd

Browse files
committed
Add JSON-LD microdata for blog posts
1 parent 3ddb6c6 commit 3b004dd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

components/PageHead.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,27 @@ export function PageHead({
9999
<meta property='og:title' content={title} />
100100
<meta name='twitter:title' content={title} />
101101
<title>{title}</title>
102+
103+
{/* Better SEO for the blog posts */}
104+
{isBlogPost && (
105+
<script type='application/ld+json'>
106+
{JSON.stringify({
107+
'@context': 'https://schema.org',
108+
'@type': 'BlogPosting',
109+
'@id': `${url}#BlogPosting`,
110+
mainEntityOfPage: url,
111+
url,
112+
headline: title,
113+
name: title,
114+
description,
115+
author: {
116+
'@type': 'Person',
117+
name: config.author
118+
},
119+
image: socialImageUrl
120+
})}
121+
</script>
122+
)}
102123
</Head>
103124
)
104125
}

0 commit comments

Comments
 (0)