Currently, I am working with nextjs and trying to display the Schema
inside the head tag. However, when I do so, it displays ":"
instead of my intended content.
This is the schema code snippet:
const Schema = (url,image) => (
<script type="application/ld+json">
{JSON.stringify({
"@context": "https://schema.org",
"@type": "NewsArticle",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": url
},
"headline": "Article headline",
"image": image,
"datePublished": datePublished,
"dateModified": dateModified,
"author": {
"@type": "Person",
"name": "****"
},
"publisher": {
"@type": "Organization",
"name": "macandental",
"logo": {
"@type": "ImageObject",
"url": "***logo.png"
}
}
})}
</script>
);
export default Schema;
Within my component:
return (
<>
<Head>
<title>{seo.title}</title>
<meta name="title" content={seo.title} />
<meta name="description" content={seo.description} />
<meta property="og:type" content="article" />
<Schema url={"/faq"}/>
</Head>
....
Unfortunately, the outcome appears as follows:
<script type="application/ld+json">{"@context":"https://schema.org","@type":"NewsAr