feat: préparation Payload CMS — couche d'abstraction contenu

Sépare données et affichage pour basculer vers Payload CMS sans réécrire les composants.

Nouveaux fichiers :
- lib/site-config.ts : source unique de vérité pour toutes les données du site (as const)
- lib/content.ts : couche async entre données et composants (static aujourd'hui, Payload demain)
- types/content.ts : types TypeScript partagés (Service, Realisation, Partner, BlogPost, etc.)
- payload/ : schémas CollectionConfig et GlobalConfig commentés prêts à activer

Données enrichies dans siteConfig :
- partners : ajout du champ desc pour chaque partenaire
- realisations : 6 entrées complètes avec categorie et color
- blogPosts : 6 articles avec slug, titre, extrait, cat, date, readTime

Refactorisations (composants → content layer) :
- Navbar, Footer : importent siteConfig directement (client component)
- app/page.tsx : async, Promise.all sur getServices/getTestimonials/getFAQ/getValues/getPartners/getRealisations
- app/services/page.tsx : getServices() + getSiteConfig()
- app/contact/page.tsx : getSiteConfig() pour phone, email, address, zones
- app/realisations/page.tsx : getRealisations() + getSiteConfig()
- app/partenaires/page.tsx : getPartners()
- app/blog/page.tsx : getBlogPosts()
- app/blog/[slug]/page.tsx : getBlogPost() + getBlogPosts() pour generateStaticParams
- LocalSEOPage.tsx : siteConfig pour services list, phone, address
- 5 pages service (construction-maison, renovation, assainissement, creation-acces, demolition) : getSiteConfig() pour phone
- Pages légales et SEO locales : siteConfig importé pour données dynamiques

Corrections URL :
- Toutes les URLs canoniques obc-maconnerie.fr → obc-terrassement.fr (30+ fichiers)
- layout.tsx : BASE_URL depuis siteConfig.url
- robots.ts, sitemap.ts : BASE_URL depuis siteConfig.url
- api/contact/route.ts : email fallback → obc-terrassement.fr

https://claude.ai/code/session_01Uec4iHjcPwB1pU41idWEdF
This commit is contained in:
Claude
2026-02-27 13:05:19 +00:00
parent 3adcec00b7
commit 15c60a274c
40 changed files with 1534 additions and 860 deletions

View File

@@ -1,6 +1,19 @@
import Link from "next/link";
import { siteConfig } from "@/lib/site-config";
export default function Footer() {
const {
name,
dirigeant,
phone,
phoneRaw,
address,
siren,
footerServicesNav,
footerMainNav,
footerLegalNav,
} = siteConfig;
return (
<footer className="bg-navy text-white pt-12 pb-6">
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
@@ -17,35 +30,33 @@ export default function Footer() {
</div>
</div>
<p className="text-white/70 text-sm leading-relaxed mb-4 max-w-xs">
Benoît Colin, maçon expert en construction de maison, rénovation et gros œuvre dans le Nord. De la première pierre à la remise des clés.
{dirigeant}, maçon expert en construction de maison, rénovation et gros
œuvre dans le Nord. De la première pierre à la remise des clés.
</p>
<a
href="tel:0674453089"
href={`tel:${phoneRaw}`}
className="inline-flex items-center gap-2 text-orange-light font-bold text-base hover:text-white transition-colors"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
</svg>
06 74 45 30 89
{phone}
</a>
<p className="text-white/40 text-xs mt-2">
221 Route de Saint-Amand, 59310 Mouchin
</p>
<p className="text-white/40 text-xs mt-2">{address}</p>
</div>
{/* Services */}
<div>
<h4 className="text-white font-semibold text-sm mb-4 uppercase tracking-wide">Services</h4>
<h4 className="text-white font-semibold text-sm mb-4 uppercase tracking-wide">
Services
</h4>
<ul className="space-y-2">
{[
{ href: "/construction-maison", label: "Construction de maison" },
{ href: "/renovation", label: "Rénovation" },
{ href: "/assainissement", label: "Assainissement" },
{ href: "/creation-acces", label: "Création d'accès" },
{ href: "/demolition", label: "Démolition" },
].map((item) => (
{footerServicesNav.map((item) => (
<li key={item.href}>
<Link href={item.href} className="text-white/60 hover:text-white text-sm transition-colors">
<Link
href={item.href}
className="text-white/60 hover:text-white text-sm transition-colors"
>
{item.label}
</Link>
</li>
@@ -53,33 +64,33 @@ export default function Footer() {
</ul>
</div>
{/* Navigation */}
{/* Navigation + Légal */}
<div>
<h4 className="text-white font-semibold text-sm mb-4 uppercase tracking-wide">Navigation</h4>
<h4 className="text-white font-semibold text-sm mb-4 uppercase tracking-wide">
Navigation
</h4>
<ul className="space-y-2">
{[
{ href: "/", label: "Accueil" },
{ href: "/realisations", label: "Réalisations" },
{ href: "/partenaires", label: "Partenaires" },
{ href: "/contact", label: "Contact" },
{ href: "/blog", label: "Blog" },
].map((item) => (
{footerMainNav.map((item) => (
<li key={item.href}>
<Link href={item.href} className="text-white/60 hover:text-white text-sm transition-colors">
<Link
href={item.href}
className="text-white/60 hover:text-white text-sm transition-colors"
>
{item.label}
</Link>
</li>
))}
</ul>
<h4 className="text-white font-semibold text-sm mb-3 mt-5 uppercase tracking-wide">Légal</h4>
<h4 className="text-white font-semibold text-sm mb-3 mt-5 uppercase tracking-wide">
Légal
</h4>
<ul className="space-y-2">
{[
{ href: "/mentions-legales", label: "Mentions légales" },
{ href: "/confidentialite", label: "Confidentialité" },
{ href: "/cgv", label: "CGV" },
].map((item) => (
{footerLegalNav.map((item) => (
<li key={item.href}>
<Link href={item.href} className="text-white/60 hover:text-white text-sm transition-colors">
<Link
href={item.href}
className="text-white/60 hover:text-white text-sm transition-colors"
>
{item.label}
</Link>
</li>
@@ -91,10 +102,12 @@ export default function Footer() {
{/* Bottom */}
<div className="pt-6 flex flex-col md:flex-row items-center justify-between gap-3">
<p className="text-white/40 text-xs text-center md:text-left">
&copy; {new Date().getFullYear()} OBC Maçonnerie &mdash; Benoît Colin &middot; SIREN 531 827 871
&copy; {new Date().getFullYear()} {name} &mdash; {dirigeant} &middot; SIREN{" "}
{siren.replace(/(\d{3})(\d{3})(\d{3})/, "$1 $2 $3")}
</p>
<p className="text-white/40 text-xs text-center md:text-right">
Orchies &middot; Mouchin &middot; Douai &middot; Valenciennes &middot; Saint-Amand-les-Eaux &mdash;{" "}
Orchies &middot; Mouchin &middot; Douai &middot; Valenciennes &middot;
Saint-Amand-les-Eaux &mdash;{" "}
<span className="text-white/30">Site réalisé par HookLab</span>
</p>
</div>

View File

@@ -3,6 +3,7 @@ import Navbar from "@/components/marketing/Navbar";
import Footer from "@/components/marketing/Footer";
import ScrollReveal from "@/components/animations/ScrollReveal";
import ContactForm from "@/components/marketing/ContactForm";
import { siteConfig } from "@/lib/site-config";
interface LocalSEOPageProps {
ville: string;
@@ -14,13 +15,13 @@ interface LocalSEOPageProps {
distanceMouchin?: string;
}
const services = [
{ icon: "🏠", label: "Construction de maison", href: "/construction-maison" },
{ icon: "🔨", label: "Rénovation", href: "/renovation" },
{ icon: "💧", label: "Assainissement", href: "/assainissement" },
{ icon: "🚧", label: "Création d'accès", href: "/creation-acces" },
{ icon: "🏗️", label: "Démolition", href: "/demolition" },
];
// Services dérivés de siteConfig (sans "conseil" qui redirige vers /contact)
const services = siteConfig.footerServicesNav.map((s) => {
const found = siteConfig.services.find(
(sc) => sc.title === s.label || `/${sc.slug}` === s.href
);
return { icon: found?.icon ?? "🔧", label: s.label, href: s.href };
});
export default function LocalSEOPage({
ville,
@@ -31,6 +32,8 @@ export default function LocalSEOPage({
texteLocal,
distanceMouchin,
}: LocalSEOPageProps) {
const { phone, phoneRaw, address } = siteConfig;
return (
<main id="main-content" className="min-h-screen">
<Navbar />
@@ -57,8 +60,8 @@ export default function LocalSEOPage({
<Link href="/contact" className="inline-flex items-center justify-center gap-2 bg-orange hover:bg-orange-hover text-white font-bold px-7 py-3.5 rounded-xl transition-colors pulse-glow">
Demander un devis gratuit
</Link>
<a href="tel:0674453089" className="inline-flex items-center justify-center gap-2 bg-white/10 hover:bg-white/20 text-white font-semibold px-7 py-3.5 rounded-xl transition-colors border border-white/20">
06 74 45 30 89
<a href={`tel:${phoneRaw}`} className="inline-flex items-center justify-center gap-2 bg-white/10 hover:bg-white/20 text-white font-semibold px-7 py-3.5 rounded-xl transition-colors border border-white/20">
{phone}
</a>
</div>
</ScrollReveal>
@@ -116,9 +119,9 @@ export default function LocalSEOPage({
</div>
<div>
<p className="text-navy font-bold text-sm">Benoît Colin OBC Maçonnerie</p>
<p className="text-text-muted text-xs">221 Route de Saint-Amand, 59310 Mouchin</p>
<a href="tel:0674453089" className="text-orange font-bold text-sm hover:underline">
06 74 45 30 89
<p className="text-text-muted text-xs">{address}</p>
<a href={`tel:${phoneRaw}`} className="text-orange font-bold text-sm hover:underline">
{phone}
</a>
</div>
</div>

View File

@@ -2,16 +2,11 @@
import { useState } from "react";
import Link from "next/link";
const navLinks = [
{ href: "/services", label: "Nos services" },
{ href: "/realisations", label: "Réalisations" },
{ href: "/partenaires", label: "Partenaires" },
{ href: "/contact", label: "Contact" },
];
import { siteConfig } from "@/lib/site-config";
export default function Navbar() {
const [open, setOpen] = useState(false);
const { name, phone, phoneRaw, nav } = siteConfig;
return (
<nav
@@ -22,9 +17,9 @@ export default function Navbar() {
<div className="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex items-center justify-between h-16">
{/* Logo */}
<Link href="/" className="flex items-center gap-2.5" aria-label="OBC Maçonnerie - Accueil">
<Link href="/" className="flex items-center gap-2.5" aria-label={`${name} - Accueil`}>
<div className="w-9 h-9 bg-navy rounded-lg flex items-center justify-center shrink-0">
<span className="text-white font-bold text-sm">OBC</span>
<span className="text-white font-bold text-xs">OBC</span>
</div>
<div className="flex flex-col leading-tight">
<span className="text-navy font-bold text-sm leading-none">OBC</span>
@@ -34,7 +29,7 @@ export default function Navbar() {
{/* Desktop links */}
<div className="hidden md:flex items-center gap-6">
{navLinks.map((link) => (
{nav.map((link) => (
<Link
key={link.href}
href={link.href}
@@ -48,13 +43,13 @@ export default function Navbar() {
{/* CTA desktop */}
<div className="hidden md:block">
<a
href="tel:0674453089"
className="inline-flex items-center gap-2 bg-orange text-white font-bold text-sm px-5 py-2.5 rounded-xl hover:bg-orange-hover transition-colors pulse-glow"
href={`tel:${phoneRaw}`}
className="inline-flex items-center gap-2 bg-orange text-white font-bold text-sm px-5 py-2.5 rounded-xl hover:bg-orange-hover transition-colors"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
</svg>
06 74 45 30 89
{phone}
</a>
</div>
@@ -80,7 +75,7 @@ export default function Navbar() {
{/* Mobile menu */}
{open && (
<div className="md:hidden border-t border-border py-4 space-y-1">
{navLinks.map((link) => (
{nav.map((link) => (
<Link
key={link.href}
href={link.href}
@@ -92,14 +87,14 @@ export default function Navbar() {
))}
<div className="pt-2">
<a
href="tel:0674453089"
href={`tel:${phoneRaw}`}
onClick={() => setOpen(false)}
className="flex items-center justify-center gap-2 bg-orange text-white font-bold text-sm px-5 py-3 rounded-xl mt-2"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" />
</svg>
Appeler Benoît 06 74 45 30 89
{phone}
</a>
</div>
</div>