/** * Applique toutes les balises SEO (og:*, Twitter Cards, canonical, description) * à partir du contenu YAML d'une page. * * Usage dans les pages : * useSeoPage({ title: content.value?.meta?.title, description: content.value?.description }) * * L'og:image par défaut est /og-default.png (logo §). * Chaque section peut surcharger avec son propre image via le champ seo.image du YAML. */ export function useSeoPage(opts: { title?: string | null description?: string | null image?: string | null type?: 'website' | 'article' | 'book' }) { const config = useRuntimeConfig() const route = useRoute() const siteUrl = (config.public.siteUrl as string) || 'https://librodrome.org' const title = opts.title || 'Le Librodrome' const description = opts.description || 'Autonomie numérique, économique et citoyenne. Un livre et des chansons sur l\'économie du don.' const rawImage = opts.image || '/og-default.png' const image = rawImage.startsWith('http') ? rawImage : `${siteUrl}${rawImage}` const canonical = `${siteUrl}${route.path}` const type = opts.type || 'website' useSeoMeta({ // Open Graph ogTitle: title, ogDescription: description, ogImage: image, ogImageWidth: 1200, ogImageHeight: 630, ogUrl: canonical, ogType: type, ogSiteName: 'Le Librodrome', ogLocale: 'fr_FR', // Twitter Cards twitterCard: 'summary_large_image', twitterTitle: title, twitterDescription: description, twitterImage: image, // Standard description, }) useHead({ link: [{ rel: 'canonical', href: canonical }], }) }