MCPcopy Create free account
hub / github.com/apisyouwonthate/openapi.tools / createFAQSchema

Function createFAQSchema

src/utils/structuredData.ts:127–142  ·  view source on GitHub ↗
(
  faqs: Array<{ question: string; answer: string }>
)

Source from the content-addressed store, hash-verified

125 * Generate FAQPage structured data for category pages
126 */
127export function createFAQSchema(
128 faqs: Array<{ question: string; answer: string }>
129): WithContext<FAQPage> {
130 return {
131 '@context': 'https://schema.org',
132 '@type': 'FAQPage',
133 mainEntity: faqs.map((faq) => ({
134 '@type': 'Question' as const,
135 name: faq.question,
136 acceptedAnswer: {
137 '@type': 'Answer' as const,
138 text: faq.answer,
139 },
140 })),
141 };
142}
143
144/**
145 * Serialize structured data to JSON string for embedding in HTML

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected