[FEAT] Add FAQ

This commit is contained in:
2025-11-26 19:27:33 +01:00
parent 0942ce5d51
commit 75e24eac42
4 changed files with 117 additions and 0 deletions

View File

@@ -18,6 +18,11 @@ export interface BreadcrumbItem {
url: string;
}
export interface FAQItem {
question: string;
answer: string;
}
export function useStructuredData() {
// Organization Schema
const addOrganizationSchema = () => {
@@ -159,11 +164,37 @@ export function useStructuredData() {
});
};
// FAQ Schema
const addFAQSchema = (faqs: FAQItem[]) => {
const schema = {
'@context': 'https://schema.org',
'@type': 'FAQPage',
mainEntity: faqs.map(faq => ({
'@type': 'Question',
name: faq.question,
acceptedAnswer: {
'@type': 'Answer',
text: faq.answer,
},
})),
};
useHead({
script: [
{
type: 'application/ld+json',
children: JSON.stringify(schema),
},
],
});
};
return {
addOrganizationSchema,
addWebSiteSchema,
addBlogPostSchema,
addBreadcrumbSchema,
addBlogListSchema,
addFAQSchema,
};
}