SPB Git

Repository Public

metadata.ts 4.7 KB 129 lines typescript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : agentilab-web8 * File             : lib/seo/metadata.ts9 * Module           : Seo10 * Repository       : https://git.spboucher.ai/agentilab-web11 * Project Website  : Not specified12 * Created          : 2026-12-0513 * Last Modified    : 2026-12-0514 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : Proprietary34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import type { Metadata } from 'next';44import type { Locale } from '@/lib/i18n/config';45import { languageTag, openGraphLocale } from '@/lib/i18n/config';46import { getCopy } from '@/lib/i18n/copy';47import { href, trail } from '@/lib/i18n/routes';48import type { RouteId } from '@/lib/i18n/routes';49import { legalIdentity } from '@/content/public/legal';50import { brands } from '@/content/public/brands';51import { BRAND_NAME, SITE_URL, absoluteUrl } from '@/lib/site';52import { crumbLabel } from '@/components/layout/Breadcrumbs';5354export const OG_IMAGE = { url: '/og.png', width: 1200, height: 630 };5556/** Métadonnées d’une page : titre et description uniques, canonical auto-référent, hreflang réciproques. */57export function pageMetadata(id: RouteId, locale: Locale): Metadata {58  const copy = getCopy(locale);59  const meta = copy.meta[id];60  const path = href(id, locale);61  return {62    metadataBase: new URL(SITE_URL),63    title: meta.title,64    description: meta.description,65    alternates: {66      canonical: path,67      languages: {68        [languageTag.fr]: href(id, 'fr'),69        [languageTag.en]: href(id, 'en'),70        'x-default': href(id, 'fr'),71      },72    },73    openGraph: {74      type: 'website',75      siteName: BRAND_NAME,76      title: meta.title,77      description: meta.description,78      url: path,79      locale: openGraphLocale[locale],80      alternateLocale: openGraphLocale[locale === 'fr' ? 'en' : 'fr'],81      images: [{ ...OG_IMAGE, alt: copy.meta.ogAlt }],82    },83    twitter: { card: 'summary_large_image', title: meta.title, description: meta.description, images: [{ ...OG_IMAGE, alt: copy.meta.ogAlt }] },84    icons: {85      icon: [86        { url: '/icon.svg', type: 'image/svg+xml' },87        { url: '/favicon-32.png', sizes: '32x32', type: 'image/png' },88      ],89      apple: [{ url: '/apple-touch-icon.png', sizes: '180x180' }],90    },91    formatDetection: { telephone: false, address: false, email: false },92  };93}9495export function notFoundMetadata(locale: Locale): Metadata {96  const meta = getCopy(locale).meta.notFound;97  return { title: meta.title, description: meta.description, robots: { index: false, follow: false } };98}99100/** JSON-LD Organization : faits publics seulement (ni adresse, ni téléphone, ni courriel non confirmé). */101export function organizationJsonLd(locale: Locale) {102  return {103    '@context': 'https://schema.org',104    '@type': 'Organization',105    '@id': `${SITE_URL}/#organization`,106    name: BRAND_NAME,107    legalName: legalIdentity.legalName,108    url: SITE_URL,109    logo: `${SITE_URL}/images/brand/agentilab-symbol-512.png`,110    foundingDate: legalIdentity.constitutedOn,111    description: getCopy(locale).meta.home.description,112    areaServed: 'CA',113    brand: brands.map((b) => ({ '@type': 'Brand', name: b.name, url: b.officialUrl[locale] })),114  };115}116117export function breadcrumbJsonLd(id: RouteId, locale: Locale) {118  return {119    '@context': 'https://schema.org',120    '@type': 'BreadcrumbList',121    itemListElement: trail(id).map((item, index) => ({122      '@type': 'ListItem',123      position: index + 1,124      name: crumbLabel(item, locale),125      item: absoluteUrl(href(item, locale)),126    })),127  };128}129
Files main
Menu

Theme