diff --git a/src/app/[locale]/news/page.tsx b/src/app/[locale]/news/page.tsx index eb5774c..a200e59 100644 --- a/src/app/[locale]/news/page.tsx +++ b/src/app/[locale]/news/page.tsx @@ -63,7 +63,7 @@ export default async function NewsHub({ params }: { params: Promise<{ locale: st
{heroArticle.coverImage ? ( - {heroArticle.title} + {heroArticle.title} ) : (
)} @@ -89,7 +89,7 @@ export default async function NewsHub({ params }: { params: Promise<{ locale: st
{article.coverImage ? ( - {article.title} + {article.title} ) : (
)} diff --git a/src/components/ui/CaseStudyModal.tsx b/src/components/ui/CaseStudyModal.tsx index 7a3baf2..edae5f3 100644 --- a/src/components/ui/CaseStudyModal.tsx +++ b/src/components/ui/CaseStudyModal.tsx @@ -26,6 +26,10 @@ interface ModalProps { data: CaseStudyData | null; } +function nodeToSlug(title: string): string { + return title.toLowerCase().trim().replace(/[^\w\s-]/g, '').replace(/[\s_-]+/g, '-').replace(/^-+|-+$/g, ''); +} + const renderMarkdown = (text: string) => { if (!text) return null; const lines = text.split('\n'); @@ -195,7 +199,8 @@ export default function CaseStudyModal({ isOpen, onClose, data }: ModalProps) { const isEvent = data.nodeType === "event"; const isHQ = data.nodeType === "hq"; - const coverImage = data.mediaFileName ? `/cases/${data.mediaFileName}` : null; + const nodeSlug = nodeToSlug(data.title); + const coverImage = data.mediaFileName ? `/cases/${nodeSlug}/${data.mediaFileName}` : null; let formattedDate = null; let isUpcoming = false; @@ -321,7 +326,7 @@ export default function CaseStudyModal({ isOpen, onClose, data }: ModalProps) {
{gallery.map((imgSrc, idx) => (
- {`Gallery + {`Gallery
))}