From 231c73c5af078872f3b45fa6558756ab772ce7e9 Mon Sep 17 00:00:00 2001 From: Edwin Noorlander Date: Wed, 19 Nov 2025 14:55:33 +0100 Subject: [PATCH] Fix breadcrumb navigation for directories - Breadcrumb items for directories are now only clickable if an index file exists - Prevents 404 errors when clicking on folder names in breadcrumb - Non-clickable directory items are shown as active text - Improves navigation UX and prevents broken links --- public/index.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/index.php b/public/index.php index 4965702..2825b3b 100644 --- a/public/index.php +++ b/public/index.php @@ -320,7 +320,15 @@ class CodePressCMS { if ($i === count($parts) - 1) { $breadcrumb .= ''; } else { - $breadcrumb .= ''; + // Check if directory has index file + $dirPath = $this->config['content_dir'] . '/' . $path; + $hasIndex = file_exists($dirPath . '/index.md') || file_exists($dirPath . '/index.php') || file_exists($dirPath . '/index.html'); + + if ($hasIndex) { + $breadcrumb .= ''; + } else { + $breadcrumb .= ''; + } } }