import React from 'react'; import Link from 'next/link'; import { notFound } from 'next/navigation'; import { ArrowLeft, User, Calendar, Share2 } from 'lucide-react'; import { prisma } from '../../../lib/prisma'; import { Metadata } from 'next'; interface Props { params: Promise<{ id: string }>; } export async function generateMetadata({ params }: Props): Promise { const { id } = await params; const post = await prisma.blogPost.findFirst({ where: { OR: [ { id: id }, { slug: id } ] } }); 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 } ] } }); if (!post) { notFound(); } return (
{/* Hero Image */}
{post.title}
Retour aux articles
{/* Header */}
{post.author} {new Date(post.date).toLocaleDateString('fr-FR', { day: 'numeric', month: 'long', year: 'numeric' })} {post.tags.length > 0 ? ( post.tags.map(tag => ( {tag} )) ) : ( Article )}

{post.title}

{/* Content */}

{post.excerpt}

{/* Footer / Share */}

Vous avez aimé cet article ?

); }