auto-claude: subtask-1-12 - Extract SoftwareAppJsonLd component
This commit is contained in:
+2
-2
@@ -18,8 +18,8 @@
|
|||||||
"max": 1
|
"max": 1
|
||||||
},
|
},
|
||||||
"session": {
|
"session": {
|
||||||
"number": 1548,
|
"number": 1556,
|
||||||
"started_at": "2026-01-25T06:23:19.101802"
|
"started_at": "2026-01-25T06:23:19.101802"
|
||||||
},
|
},
|
||||||
"last_update": "2026-01-25T11:16:43.611638"
|
"last_update": "2026-01-25T11:18:16.694552"
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { type Locale } from '@/i18n/config';
|
||||||
|
|
||||||
|
interface SoftwareAppJsonLdProps {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
applicationCategory: string;
|
||||||
|
operatingSystem?: string;
|
||||||
|
offers?: {
|
||||||
|
price: string;
|
||||||
|
priceCurrency: string;
|
||||||
|
};
|
||||||
|
aggregateRating?: {
|
||||||
|
ratingValue: string;
|
||||||
|
ratingCount: string;
|
||||||
|
};
|
||||||
|
locale: Locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SoftwareAppJsonLd({
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
applicationCategory,
|
||||||
|
operatingSystem = 'Web',
|
||||||
|
offers,
|
||||||
|
aggregateRating,
|
||||||
|
locale,
|
||||||
|
}: SoftwareAppJsonLdProps) {
|
||||||
|
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://damjan-savic.com';
|
||||||
|
|
||||||
|
const schema: Record<string, unknown> = {
|
||||||
|
'@context': 'https://schema.org',
|
||||||
|
'@type': 'SoftwareApplication',
|
||||||
|
name: name,
|
||||||
|
description: description,
|
||||||
|
applicationCategory: applicationCategory,
|
||||||
|
operatingSystem: operatingSystem,
|
||||||
|
author: {
|
||||||
|
'@id': `${baseUrl}/#person`,
|
||||||
|
},
|
||||||
|
inLanguage: locale === 'de' ? 'de-DE' : locale === 'sr' ? 'sr-RS' : 'en-US',
|
||||||
|
};
|
||||||
|
|
||||||
|
if (offers) {
|
||||||
|
schema.offers = {
|
||||||
|
'@type': 'Offer',
|
||||||
|
price: offers.price,
|
||||||
|
priceCurrency: offers.priceCurrency,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aggregateRating) {
|
||||||
|
schema.aggregateRating = {
|
||||||
|
'@type': 'AggregateRating',
|
||||||
|
ratingValue: aggregateRating.ratingValue,
|
||||||
|
ratingCount: aggregateRating.ratingCount,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<script
|
||||||
|
type="application/ld+json"
|
||||||
|
dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user