From a86b89dc980c8b200501e425609988e2f01fb822 Mon Sep 17 00:00:00 2001 From: webfussel Date: Wed, 11 Jun 2025 08:54:32 +0200 Subject: [PATCH] add: extract plain faq Add Schema Org for FAQ --- app/components/Section/Booking.vue | 18 +++++++++++++++++- app/components/Spoiler.vue | 3 ++- app/composables/faq.ts | 20 ++++++++++++++++++++ content.config.ts | 10 +--------- package-lock.json | 1 - 5 files changed, 40 insertions(+), 12 deletions(-) create mode 100644 app/composables/faq.ts diff --git a/app/components/Section/Booking.vue b/app/components/Section/Booking.vue index e952459..f557b91 100755 --- a/app/components/Section/Booking.vue +++ b/app/components/Section/Booking.vue @@ -129,5 +129,21 @@ const oneOff : Service[] = [ }, ] -const faq = await queryCollection('faq').path('/snippets/faq/booking').first() +const { data: faq } = await useAsyncData('faq', () => queryCollection('faq').path('/snippets/faq/booking').first()) +const texts = usePlainFaq(faq.value?.body.value) + +if (faq) { + useSchemaOrg({ + '@context': 'https://schema.org', + '@type': 'FAQPage', + 'mainEntity': texts.map(entity => ({ + '@type': 'Question', + 'name': entity.question, + 'acceptedAnswer': { + '@type': 'Answer', + 'text': entity.answer, + }, + })) + }) +} diff --git a/app/components/Spoiler.vue b/app/components/Spoiler.vue index 623fe06..b136408 100644 --- a/app/components/Spoiler.vue +++ b/app/components/Spoiler.vue @@ -10,9 +10,10 @@