From d439a1a9c28ed68d720d70dc51e6d2a28a8f218a Mon Sep 17 00:00:00 2001 From: Andreas Ferber Date: Sat, 25 Nov 2017 22:26:50 +0100 Subject: [PATCH] Bring single page title in line with other DW practice Generally, in Dokuwiki either the first page heading or (in the absence of that) the page name without the namespace is used as the page title. --- renderer/page.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/renderer/page.php b/renderer/page.php index b8d75f26..9c5803a1 100644 --- a/renderer/page.php +++ b/renderer/page.php @@ -150,6 +150,7 @@ protected function setupUnits() function document_setup() { global $ID; + global $conf; // First, get export mode. $warning = ''; @@ -235,7 +236,17 @@ function document_setup() // Set title in meta info. // FIXME article title != book title SOLUTION: overwrite at the end for book - $this->document->setTitle($ID); + $title = p_get_first_heading($ID); + if (empty($title)) { + $title = noNS($ID); + if ($title == $conf['start'] || $title == false) { + $title = noNS(getNS($ID)); + if ($title == false) { + $title = $ID; + } + } + } + $this->document->setTitle($title); // Enable/disable links according to configuration $disabled = $this->config->getParam ('disable_links');