auto-claude: subtask-1-5 - Extract FAQJsonLd component

This commit is contained in:
2026-01-25 06:34:31 +01:00
parent 34ac65c534
commit ee048ef70f
2 changed files with 32 additions and 3 deletions
+29
View File
@@ -0,0 +1,29 @@
import { type Locale } from '@/i18n/config';
interface FAQItem {
question: string;
answer: string;
}
export function FAQJsonLd({ items, locale }: { items: FAQItem[]; locale?: Locale }) {
const schema = {
'@context': 'https://schema.org',
'@type': 'FAQPage',
inLanguage: locale ? (locale === 'de' ? 'de-DE' : locale === 'sr' ? 'sr-RS' : 'en-US') : 'de-DE',
mainEntity: items.map((item) => ({
'@type': 'Question',
name: item.question,
acceptedAnswer: {
'@type': 'Answer',
text: item.answer,
},
})),
};
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(schema) }}
/>
);
}