[DokuWiki] Edit the title of Bootstrap3 Template in a cool way
Posted in php, blog on November 4, 2020 by Henk Verlinde ‐ 2 min read
![[DokuWiki] Edit the title of Bootstrap3 Template in a cool way](https://wiblok.com/images/default-image_hu52edeca5cae62b99dc9f1d2237aed73e_4694_60050dd86c09508e07ff109641ac1e38.png)
Introduction
When the DokuWiki site I manage (Bootstrap3 Template) is indexed, [dokuwiki [title]] is displayed, which is lame and hard to see. I changed the title in version [v2018-02-16] below. I will also list the change method in the postscript [v2019-05-22].
modify from site settings
If you use Bootstrap3 Template, if you set tpl»bootstrap3»browserTitle [@TITLE@-@WIKI@] from the management screen, you can fix it to [dokuwiki-title]. dokuwiki-first:second:third] is displayed and it becomes even more ugly
modify source
Modify the following file [dokuwiki folder]/lib/tpl/bootstrap3/tpl_functions.php
around line 18
include_once(dirname(__FILE__) . '/inc/simple_html_dom.php');
fix below
include_once(dirname(__FILE__) . '/inc/parserutils.php');
include_once(dirname(__FILE__) . '/inc/simple_html_dom.php');
around line 1308
return str_replace(array('@WIKI@', '@TITLE@'),
array(strip_tags($conf['title']), $browser_title),
bootstrap3_conf('browserTitle'));
fix below
$browser_title = p_get_metadata($ID,$key='title');
return str_replace(array('@WIKI@', '@TITLE@'),
array(strip_tags($conf['title']), $browser_title),
bootstrap3_conf('browserTitle'));
The return value of the getBrowserPageTitle function will be the title of the Dokuwiki page.
With the above changes, if you pull the heading from the metadate of the page and overwrite $browser_title as it is, the heading will be the title as it is. In other words, [===== headline ======] If such a headline is set on the page, it will be [dokuwiki-headline]
What you have to be careful about is that if you don’t set the heading, it will become dokuwiki-.
How to deal with v2019-05-22 Since the version has been upgraded recently, I had to change the source editing method. It’s easier to say, so if you can do the above description, it shouldn’t be a problem.
All you have to do is add the following to 1308 of [/lib/tpl/bootstrap3/Template.php].
$browser_title = p_get_metadata($ID,$key='title');