add: more SEO meta

More seometa, better markdown parser
This commit is contained in:
webfussel 2025-06-11 18:49:19 +02:00
parent ca3868299c
commit fa0435efdf
10 changed files with 52 additions and 14 deletions

View file

@ -1,20 +0,0 @@
import type { MinimalElement, MinimalNode } from '@nuxt/content'
const extractText = (element ?: MinimalNode) : string => {
if (!element) return ''
if (typeof element === 'string') return element
const [,, ...nodes] = element
return nodes?.map((el : MinimalNode) => typeof el === 'string' ? el : extractText(el)).join(' ') ?? ''
}
export const usePlainFaq = (body ?: MinimalNode[]) => {
if (!body) return []
return body.map(part => {
const [, meta] = part as MinimalElement
return {
question: meta.title,
answer: extractText(part).replace(/\n/g, ' ')
}
})
}