import { notFound } from "next/navigation"; import Image from "next/image"; import Link from "next/link"; import Nav from "../../components/Nav"; import { fetchPortfolioPostBySlug, fetchMedia } from "../../utils/useWordpress"; export default async function ProjectDetail({ params }) { const { slug } = params; if (!slug) { notFound(); } let post = null; let featuredImageUrl = null; try { // Récupérer le post par son slug post = await fetchPortfolioPostBySlug(slug, { next: { revalidate: 3600 }, // Revalide toutes les heures }); if (!post) { notFound(); } // Récupérer l'image featured si elle existe if (post.featured_media) { featuredImageUrl = await fetchMedia(post.featured_media, { next: { revalidate: 3600 }, }); } } catch (error) { console.error("Erreur lors de la récupération du projet:", error); notFound(); } return (
); }