add: extract plain faq
Add Schema Org for FAQ in Flatrate
This commit is contained in:
parent
a86b89dc98
commit
ca3868299c
3 changed files with 25 additions and 7 deletions
|
@ -138,5 +138,21 @@ const flatrate : Service[] =
|
|||
}
|
||||
]
|
||||
|
||||
const faq = await queryCollection('faq').path('/snippets/faq/flatrate').first()
|
||||
const { data : faq } = await useAsyncData('faq', () => queryCollection('faq').path('/snippets/faq/flatrate').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,
|
||||
},
|
||||
}))
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue