Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : Vrai-Prix8 * File : src/lib/seo.ts9 * Module : lib10 * Repository : https://git.spboucher.ai/vrai-prix11 * Created : 2026-08-1312 * Last Modified : 2026-08-1313 *14 * Author : Simon-Pierre Boucher15 * Position : Professor of Finance16 * Institution : Université du Québec en Outaouais (UQO)17 * Organization : SP Boucher18 * Website : https://spboucher.ai19 * Git : https://git.spboucher.ai20 *21 * Preferred Contact: contact@spboucher.ai22 * Development : dev@spboucher.ai23 * Support : support@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// Auteur : Simon-Pierre Boucher — contact@spboucher.ai43// Constantes et aides SEO : URL canonique du site, slugs, libellés de types.4445export const SITE_URL =46 process.env.NEXT_PUBLIC_SITE_URL ?? "https://www.vrai-prix.com";4748export const SITE_NAME = "Vrai-Prix";4950/** Adresse de contact unique du site. */51export const CONTACT_EMAIL = "contact@spboucher.ai";5253/**54 * Préproduction : le site n'est pas servi sur www.vrai-prix.com. Il ne doit55 * jamais être indexé (robots.txt Disallow, <meta robots>, X-Robots-Tag).56 * Activé par VP_PREPROD=1 (lu au build et à l'exécution).57 */58export const PREPROD = process.env.VP_PREPROD === "1";5960/** Version publique du site et de son API (voir /api/version). */61export const APP_VERSION = "2.0.0";62export const API_VERSION = 2;6364/** Slug URL d'un nom de municipalité (unique sur les 1 097 noms — vérifié). */65export function slugify(name: string): string {66 return name67 .normalize("NFD")68 // retire les diacritiques combinants (é → e)69 .replace(/[\u0300-\u036f]/g, "")70 .toLowerCase()71 .replace(/['’]/g, "-")72 .replace(/[^a-z0-9]+/g, "-")73 .replace(/^-+|-+$/g, "");74}7576/** type_prop (DB) → segment d'URL. */77export const TYPE_SLUGS: Record<string, string> = {78 unifamilial: "maison",79 plex: "plex",80 chalet: "chalet",81 condo_ou_multi: "condo",82 terrain: "terrain",83 maison_mobile: "maison-mobile",84 autre: "autre",85};8687/** segment d'URL → type_prop (DB). */88export const SLUG_TYPES: Record<string, string> = Object.fromEntries(89 Object.entries(TYPE_SLUGS).map(([k, v]) => [v, k])90);9192/** Libellés français des types de propriété. */93export const TYPE_LABELS: Record<string, { singulier: string; pluriel: string }> = {94 unifamilial: { singulier: "maison unifamiliale", pluriel: "maisons unifamiliales" },95 plex: { singulier: "plex", pluriel: "plex (2 à 5 logements)" },96 chalet: { singulier: "chalet", pluriel: "chalets et résidences secondaires" },97 condo_ou_multi: { singulier: "condo ou multirésidentiel", pluriel: "condos et multirésidentiel" },98 terrain: { singulier: "terrain", pluriel: "terrains vacants" },99 maison_mobile: { singulier: "maison mobile", pluriel: "maisons mobiles" },100 autre: { singulier: "autre propriété", pluriel: "autres propriétés" },101};102103/** 425 000 → « 425 000 $ » (fr-CA, sans décimales). */104export function moneyFr(v: number | null | undefined): string {105 if (v == null) return "—";106 return new Intl.NumberFormat("fr-CA", {107 style: "currency",108 currency: "CAD",109 maximumFractionDigits: 0,110 }).format(v);111}112113/** 3747008 → « 3 747 008 » (fr-CA). */114export function numFr(v: number): string {115 return v.toLocaleString("fr-CA");116}117118/** Millésime courant des estimations (dernier millésime du rôle chargé). */119export const EST_YEAR = 2026;120