parent
9c24ff23e3
commit
4b681c6317
6 changed files with 93 additions and 53 deletions
@ -0,0 +1,40 @@ |
|||||||
|
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, |
||||||
|
}; |
||||||
|
} |
Loading…
Reference in new issue