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:
95
payload/globals/SiteSettings.ts
Normal file
95
payload/globals/SiteSettings.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
// payload/globals/SiteSettings.ts
|
||||
// Schéma Payload CMS pour les paramètres globaux du site.
|
||||
// COMMENTÉ — activé lors de la migration vers Payload.
|
||||
//
|
||||
// Permet à Benoît (ou à un admin) de modifier les infos
|
||||
// de contact, le texte du hero, etc. sans toucher au code.
|
||||
|
||||
/*
|
||||
import type { GlobalConfig } from 'payload'
|
||||
|
||||
export const SiteSettings: GlobalConfig = {
|
||||
slug: 'site-settings',
|
||||
admin: {
|
||||
group: 'Paramètres',
|
||||
},
|
||||
fields: [
|
||||
// ── Informations de contact ───────────────────────────────
|
||||
{
|
||||
name: 'contact',
|
||||
type: 'group',
|
||||
label: 'Contact',
|
||||
fields: [
|
||||
{ name: 'phone', type: 'text', label: 'Téléphone' },
|
||||
{ name: 'email', type: 'email', label: 'Email' },
|
||||
{ name: 'address', type: 'text', label: 'Adresse complète' },
|
||||
],
|
||||
},
|
||||
// ── Hero page d'accueil ───────────────────────────────────
|
||||
{
|
||||
name: 'hero',
|
||||
type: 'group',
|
||||
label: 'Section Hero (page d\'accueil)',
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', label: 'Titre H1' },
|
||||
{ name: 'subtitle', type: 'textarea', label: 'Sous-titre' },
|
||||
{ name: 'badge', type: 'text', label: 'Badge/accroche' },
|
||||
{ name: 'cta', type: 'text', label: 'CTA principal' },
|
||||
{ name: 'ctaSecondary', type: 'text', label: 'CTA secondaire' },
|
||||
],
|
||||
},
|
||||
// ── Zone d'intervention ────────────────────────────────────
|
||||
{
|
||||
name: 'zones',
|
||||
type: 'array',
|
||||
label: 'Villes d\'intervention',
|
||||
fields: [
|
||||
{ name: 'city', type: 'text', label: 'Ville' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'zoneDescription',
|
||||
type: 'text',
|
||||
label: 'Description zone (ex: 20 à 30 km autour de Mouchin)',
|
||||
},
|
||||
// ── SEO global ────────────────────────────────────────────
|
||||
{
|
||||
name: 'seo',
|
||||
type: 'group',
|
||||
label: 'SEO global',
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', label: 'Titre SEO par défaut' },
|
||||
{ name: 'description', type: 'textarea', label: 'Description SEO par défaut' },
|
||||
],
|
||||
},
|
||||
// ── Message partenaires ───────────────────────────────────
|
||||
{
|
||||
name: 'partnersMessage',
|
||||
type: 'textarea',
|
||||
label: 'Message section partenaires',
|
||||
},
|
||||
],
|
||||
}
|
||||
*/
|
||||
|
||||
export type PayloadSiteSettings = {
|
||||
contact: {
|
||||
phone: string;
|
||||
email: string;
|
||||
address: string;
|
||||
};
|
||||
hero: {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
badge: string;
|
||||
cta: string;
|
||||
ctaSecondary: string;
|
||||
};
|
||||
zones: { city: string }[];
|
||||
zoneDescription: string;
|
||||
seo: {
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
partnersMessage: string;
|
||||
};
|
||||
Reference in New Issue
Block a user