computer-scienceangular-roadmapbackend-roadmapblockchain-roadmapdba-roadmapdeveloper-roadmapdevops-roadmapfrontend-roadmapgo-roadmaphactoberfestjava-roadmapjavascript-roadmapnodejs-roadmappython-roadmapqa-roadmapreact-roadmaproadmapstudy-planvue-roadmapweb3-roadmap
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
939 B
41 lines
939 B
2 years ago
|
type ArticleSchemaProps = {
|
||
|
url: string;
|
||
|
headline: string;
|
||
|
description: string;
|
||
|
imageUrl: string;
|
||
|
datePublished: string;
|
||
|
dateModified: string;
|
||
|
};
|
||
|
|
||
|
export function generateArticleSchema(article: ArticleSchemaProps) {
|
||
|
const { url, headline, description, imageUrl, datePublished, dateModified } =
|
||
|
article;
|
||
|
|
||
|
return {
|
||
|
'@context': 'https://schema.org',
|
||
|
'@type': 'BlogPosting',
|
||
|
mainEntityOfPage: {
|
||
|
'@type': 'WebPage',
|
||
|
'@id': url,
|
||
|
},
|
||
|
headline: headline,
|
||
|
description: description,
|
||
|
image: imageUrl,
|
||
|
author: {
|
||
|
'@type': 'Person',
|
||
|
name: 'Kamran Ahmed',
|
||
|
url: 'https://twitter.com/kamranahmedse',
|
||
|
},
|
||
|
publisher: {
|
||
|
'@type': 'Organization',
|
||
|
name: 'roadmap.sh',
|
||
|
logo: {
|
||
|
'@type': 'ImageObject',
|
||
|
url: 'https://roadmap.sh/images/brand-square.png',
|
||
|
},
|
||
|
},
|
||
|
datePublished: datePublished,
|
||
|
dateModified: dateModified,
|
||
|
};
|
||
|
}
|