Skip to content

lib

生成 Schema.org 标签 JSON-ld


getSchemaTags.ts
export const getSchemaTags = () => {
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
'@context': 'http://schema.org',
'@type': 'SoftwareApplication',
name: site.name,
description: site.description,
image: `${site.siteUrl}/icon.png`,
url: site.siteUrl,
author: {
'@type': 'Person',
name: 'Ali Hussein',
},
datePublished: '2023-08-01',
applicationCategory: 'EducationalApplication',
aggregateRating: {
'@type': 'AggregateRating',
ratingValue: '4.8',
ratingCount: '12',
},
offers: [
{
'@type': 'Offer',
price: '9.00',
priceCurrency: 'USD',
},
],
}),
}}
>
{' '}
</script>
);
};