implementation of JSON-LD
This commit is contained in:
@@ -117,8 +117,47 @@ export default async function ArticlePage({ params }: props) {
|
|||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const articleUrl = `${siteUrl}/${locale}/blog/${slug}`;
|
||||||
|
|
||||||
|
const imageUrl = article.cover
|
||||||
|
? article.cover.startsWith("http")
|
||||||
|
? article.cover
|
||||||
|
: `${siteUrl}${article.cover}`
|
||||||
|
: `${siteUrl}/og-image.jpg`;
|
||||||
|
|
||||||
|
const jsonLd = {
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "BlogPosting",
|
||||||
|
headline: article.title,
|
||||||
|
description: article.description,
|
||||||
|
image: imageUrl,
|
||||||
|
datePublished: article.date,
|
||||||
|
dateModified: article.date,
|
||||||
|
author: {
|
||||||
|
"@type": "Person",
|
||||||
|
name: "Mathéo Guilbert",
|
||||||
|
url: siteUrl,
|
||||||
|
},
|
||||||
|
publisher: {
|
||||||
|
"@type": "Person",
|
||||||
|
name: "Mathéo Guilbert",
|
||||||
|
url: siteUrl,
|
||||||
|
},
|
||||||
|
mainEntityOfPage: {
|
||||||
|
"@type": "WebPage",
|
||||||
|
"@id": articleUrl,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="bg-brand-beige">
|
<main className="bg-brand-beige">
|
||||||
|
<script
|
||||||
|
type="application/ld+json"
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: JSON.stringify(jsonLd),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<ArticleHero
|
<ArticleHero
|
||||||
locale={locale}
|
locale={locale}
|
||||||
title={article.title}
|
title={article.title}
|
||||||
|
|||||||
Reference in New Issue
Block a user