diff --git a/engine/core/class/CodePressCMS.php b/engine/core/class/CodePressCMS.php index e4d6702..7c45d31 100644 --- a/engine/core/class/CodePressCMS.php +++ b/engine/core/class/CodePressCMS.php @@ -260,6 +260,7 @@ class CodePressCMS { // If no exact match found, check for language-specific versions if (!isset($result)) { + $result = null; // Reset result before language-specific search $langPrefix = $this->currentLanguage; if (file_exists($this->config['content_dir'] . '/' . $langPrefix . '.' . $pageWithoutExt . '.md')) { @@ -276,7 +277,9 @@ class CodePressCMS { // If no file found, check if it's a directory if (!isset($result) && is_dir($filePath)) { - return $this->getDirectoryListing($pageWithoutExt, $filePath); + $directoryResult = $this->getDirectoryListing($pageWithoutExt, $filePath); + file_put_contents('/tmp/debug_directory.txt', "Directory result title: '" . $directoryResult['title'] . "'\n"); + return $directoryResult; } if (isset($result) && $actualFilePath) { @@ -730,6 +733,9 @@ class CodePressCMS { 'content' => $content ]; + // Debug: ensure we're returning the right title + error_log("DEBUG: getDirectoryListing returning title: '$title'"); + if (!is_dir($dirPath)) { return [ 'title' => $title, @@ -837,6 +843,7 @@ class CodePressCMS { $templateData = [ 'site_title' => $this->config['site_title'], 'page_title' => htmlspecialchars($page['title']), + 'debug_page_title' => $page['title'], // Debug: show raw title 'content' => $page['content'], 'search_query' => isset($_GET['search']) ? htmlspecialchars($_GET['search']) : '', 'menu' => $this->renderMenu($menu), diff --git a/engine/templates/assets/footer.mustache b/engine/templates/assets/footer.mustache index def810e..8629b31 100644 --- a/engine/templates/assets/footer.mustache +++ b/engine/templates/assets/footer.mustache @@ -6,6 +6,7 @@