Add debug logging for directory title processing
- Add debug output to getDirectoryListing() method - Add debug_page_title to template data for troubleshooting - Investigate why directory listings show 'Untitled' in footer - Directory content shows correct H1 title but page_title is wrong
This commit is contained in:
parent
b92d192399
commit
e1e3207305
@ -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),
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
<div class="file-info">
|
||||
<i class="bi bi-file-text"></i>
|
||||
<span class="page-title" title="{{page_title}}">{{page_title}}</span>
|
||||
<!-- DEBUG: Raw title: {{debug_page_title}} -->
|
||||
{{{file_info_block}}}
|
||||
</div>
|
||||
<div class="site-info">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user