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:
94
payload/collections/Articles.ts
Normal file
94
payload/collections/Articles.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
// payload/collections/Articles.ts
|
||||
// Schéma Payload CMS pour les articles de blog.
|
||||
// COMMENTÉ — activé lors de la migration vers Payload.
|
||||
|
||||
/*
|
||||
import type { CollectionConfig } from 'payload'
|
||||
import { lexicalEditor } from '@payloadcms/richtext-lexical'
|
||||
|
||||
export const Articles: CollectionConfig = {
|
||||
slug: 'articles',
|
||||
admin: {
|
||||
useAsTitle: 'title',
|
||||
defaultColumns: ['title', 'category', 'status', 'publishedAt'],
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'text',
|
||||
required: true,
|
||||
label: 'Titre de l\'article',
|
||||
},
|
||||
{
|
||||
name: 'slug',
|
||||
type: 'text',
|
||||
required: true,
|
||||
unique: true,
|
||||
label: 'URL (slug)',
|
||||
admin: {
|
||||
description: 'ex: combien-coute-construction-maison-nord',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'excerpt',
|
||||
type: 'textarea',
|
||||
label: 'Extrait (meta description)',
|
||||
},
|
||||
{
|
||||
name: 'content',
|
||||
type: 'richText',
|
||||
editor: lexicalEditor(),
|
||||
label: 'Contenu complet',
|
||||
},
|
||||
{
|
||||
name: 'category',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: 'Construction', value: 'construction' },
|
||||
{ label: 'Rénovation', value: 'renovation' },
|
||||
{ label: 'Assainissement', value: 'assainissement' },
|
||||
{ label: 'Conseils', value: 'conseils' },
|
||||
],
|
||||
label: 'Catégorie',
|
||||
},
|
||||
{
|
||||
name: 'publishedAt',
|
||||
type: 'date',
|
||||
label: 'Date de publication',
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: 'Brouillon', value: 'draft' },
|
||||
{ label: 'Publié', value: 'published' },
|
||||
],
|
||||
defaultValue: 'draft',
|
||||
label: 'Statut',
|
||||
},
|
||||
{
|
||||
name: 'seoTitle',
|
||||
type: 'text',
|
||||
label: 'Titre SEO (optionnel — remplace title)',
|
||||
},
|
||||
{
|
||||
name: 'seoDescription',
|
||||
type: 'textarea',
|
||||
label: 'Description SEO (optionnel — remplace excerpt)',
|
||||
},
|
||||
],
|
||||
}
|
||||
*/
|
||||
|
||||
export type PayloadArticle = {
|
||||
id: string;
|
||||
slug: string;
|
||||
title: string;
|
||||
excerpt: string;
|
||||
content: unknown; // Lexical rich text
|
||||
category: string;
|
||||
publishedAt: string;
|
||||
status: "draft" | "published";
|
||||
seoTitle?: string;
|
||||
seoDescription?: string;
|
||||
};
|
||||
Reference in New Issue
Block a user