Final
This commit is contained in:
15
src/lib/schema-utils.ts
Normal file
15
src/lib/schema-utils.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
export function generateFaqSchema(questions: Record<string, { question: string; answer: string }>) {
|
||||
return {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'FAQPage',
|
||||
mainEntity: Object.values(questions).map((item) => ({
|
||||
'@type': 'Question',
|
||||
name: item.question,
|
||||
acceptedAnswer: {
|
||||
'@type': 'Answer',
|
||||
text: item.answer,
|
||||
},
|
||||
})),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user