import React from 'react'; import Link from 'next/link'; import { notFound } from 'next/navigation'; import { ArrowLeft, User, Calendar, Share2 } from 'lucide-react'; import { sanitizeHTML } from '../../../lib/sanitize'; import { prisma } from '../../../lib/prisma'; import BlogShareButtons from '../../../components/BlogShareButtons'; import { Metadata } from 'next'; interface Props { params: Promise<{ id: string }>; } // Style spécifique pour empêcher strictement la coupure des mots tout en justifiant le texte const noBreakStyle = ` #blog-content, #blog-content p, #blog-content li, #blog-content span, #blog-content strong { word-break: normal !important; overflow-wrap: break-word !important; hyphens: none !important; line-break: normal !important; text-align: justify !important; text-justify: inter-word !important; } /* Sécurité supplémentaire pour les navigateurs mobiles */ .prose * { word-break: normal !important; hyphens: none !important; } `; export async function generateMetadata({ params }: Props): Promise { const { id } = await params; const post = await prisma.blogPost.findFirst({ where: { OR: [{ id: id }, { slug: id }], publishedAt: { lte: new Date() }, status: 'PUBLISHED' } }); if (!post) return { title: 'Article non trouvé' }; return { title: post.metaTitle || post.title, description: post.metaDescription || post.excerpt, keywords: post.tags, openGraph: { title: post.metaTitle || post.title, description: post.metaDescription || post.excerpt, images: [post.imageUrl], type: 'article', } }; } export default async function BlogPostPage({ params }: Props) { const { id } = await params; const post = await prisma.blogPost.findFirst({ where: { OR: [{ id: id }, { slug: id }], publishedAt: { lte: new Date() }, status: 'PUBLISHED' } }); if (!post) { notFound(); } return (
{/* Injection du style de force pour le texte */}