Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AB8CwgrRNDCUvEnhvL5wRP
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { canoniqueEvenement, estHoteEvenement, lienEvenement } from '~/utils/evenements'
|
|
import { SITE_EVENT } from '~/utils/seo'
|
|
|
|
/**
|
|
* Pages d'événement : sur quel hôte on est, comment écrire un lien, et la tête SEO.
|
|
* La canonique et le robots posés ici l'emportent sur ceux du plugin B23 (mêmes clés,
|
|
* mêmes valeurs) : Y part seul en prod, avant B23.
|
|
*/
|
|
export function useEvenement() {
|
|
const surEvent = estHoteEvenement(useRequestURL().hostname)
|
|
const lien = (chemin: string) => lienEvenement(chemin, surEvent)
|
|
|
|
function seo(o: { chemin: string; titre: string; description: string; image: string; alt: string }) {
|
|
const canon = canoniqueEvenement(o.chemin)
|
|
const image = SITE_EVENT + o.image
|
|
useSeoMeta({
|
|
title: o.titre,
|
|
description: o.description,
|
|
ogTitle: o.titre,
|
|
ogDescription: o.description,
|
|
ogImage: image,
|
|
ogImageAlt: o.alt,
|
|
ogUrl: canon,
|
|
ogType: 'website',
|
|
ogLocale: 'fr_FR',
|
|
twitterCard: 'summary_large_image',
|
|
})
|
|
useHead({
|
|
link: [{ rel: 'canonical', href: canon }],
|
|
meta: surEvent ? [] : [{ name: 'robots', content: 'noindex, follow' }],
|
|
})
|
|
}
|
|
|
|
return { surEvent, lien, seo }
|
|
}
|