This commit is contained in:
Timo Knuth
2026-02-05 12:42:16 +01:00
parent 47e54a4464
commit db93e678ee
3 changed files with 138 additions and 3 deletions

View File

@@ -321,3 +321,41 @@ export function aggregateRatingSchema(aggregateRating: AggregateRating) {
}
};
}
export interface NewsArticleParams {
headline: string;
datePublished: string;
description: string;
url?: string;
}
export function newsArticleSchema(params: NewsArticleParams) {
return {
'@context': 'https://schema.org',
'@type': 'NewsArticle',
headline: params.headline,
datePublished: params.datePublished,
description: params.description,
url: params.url || SITE_URL,
author: {
'@type': 'Organization',
name: 'QR Master',
'@id': `${SITE_URL}/#organization`,
},
publisher: {
'@type': 'Organization',
name: 'QR Master',
'@id': `${SITE_URL}/#organization`,
logo: {
'@type': 'ImageObject',
url: `${SITE_URL}/static/og-image.png`,
width: 1200,
height: 630,
},
},
mainEntityOfPage: {
'@type': 'WebPage',
'@id': params.url || SITE_URL,
},
};
}