fix(core): update

This commit is contained in:
Philipp Kunz 2020-11-04 18:31:25 +00:00
parent c1f82be85f
commit ccd68a1257

View File

@ -35,6 +35,36 @@ export class JsonLdTag extends Tag {
return ldTag; return ldTag;
} }
public static createNewsArticleLd (newsArticleArg: plugins.tsclass.content.IArticle) {
const newsArticleLd = {
"@context": "https://schema.org",
"@type": "NewsArticle",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": window.location.href
},
"headline": "Article headline",
"image": [
newsArticleArg.featuredImageUrl
],
"datePublished": new Date(newsArticleArg.timestamp).toISOString(),
"dateModified": new Date(newsArticleArg.timestamp).toISOString(),
"author": {
"@type": "Person",
"name": `${newsArticleArg.author.firstName} ${newsArticleArg.author.surName}`
},
"publisher": {
"@type": "Organization",
"name": newsArticleArg.author.surName, // TODO
"logo": {
"@type": "ImageObject",
"url": newsArticleArg.author.surName // TODO
}
},
"description": newsArticleArg.author.firstName
};
}
constructor(ldObjectArg: any) { constructor(ldObjectArg: any) {
super(); super();
const jsonLdElement = document.createElement('script'); const jsonLdElement = document.createElement('script');