Plugin content-pages : - Modèle Prisma ContentPage (slug PK, title, body markdown, category, published) - lib/content-pages.ts : helpers upsert/get/list/unpublish - lib/markdown.ts : mini-renderer markdown server-side sans deps externe (h1-h3, paragraphes, gras/italique, liens, listes ul/ol, hr, blockquote, échappement HTML) - ContentPageRenderer server component, applique le theme Guyane (font-serif) - 5 pages seedées : /a-propos, /faq, /comment-ca-marche, /pour-comites-entreprise, /devenir-loueur - Routes publiques + force-dynamic + guard requirePluginOr404 Plugin legal-pages : - Réutilise le même modèle ContentPage, catégorie 'legal' - 3 pages seedées : /cgv, /mentions-legales, /politique-de-confidentialite (contenu de base, à valider par avocat avant prod réelle) Admin : - /admin/content-pages : table par catégorie, statut publié/dépublié - /admin/content-pages/[slug] : éditeur markdown + toggle publié - PATCH /api/admin/content-pages/[slug] Hooks plugin : - onEnable seed + republish toutes les pages - onDisable dépublie toute la catégorie sans la supprimer (preserve les edits)
18 lines
670 B
TypeScript
18 lines
670 B
TypeScript
import { notFound } from "next/navigation";
|
|
import { getContentPage } from "@/lib/content-pages";
|
|
import { isPluginEnabled } from "@/lib/plugins/server";
|
|
import { ContentPageRenderer } from "@/components/ContentPageRenderer";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function generateMetadata() {
|
|
const page = await getContentPage("comment-ca-marche");
|
|
return { title: page?.title ?? "Comment ça marche" };
|
|
}
|
|
|
|
export default async function HowItWorksPage() {
|
|
if (!(await isPluginEnabled("content-pages"))) notFound();
|
|
const page = await getContentPage("comment-ca-marche");
|
|
if (!page) notFound();
|
|
return <ContentPageRenderer page={page} />;
|
|
}
|