Table of Contents
DokuWiki Tweaks
Dokuwiki Template CSS
Standard settings for font sizes etc. for different elements is here:
/var/www/html/dokuwiki/lib/tpl/dokuwiki/css/design.less
- add any modified tweaks to the CSS to a
userstyle.css
i.e./var/www/html/dokuwiki/conf/userstyle.css
font-size
etc
pre { border-radius: 10px; background-color: #fcffff } code { color: #c72522; font-size: 1.1em; padding: 0.1em 0.3em; border-radius: 0px; } .dokuwiki .aside { font-size: 90%; } body { font-size: 90%; } .dokuwiki div.breadcrumbs { font-size: 90%; }
See also Dokuwiki Template monospace font
Dokuwiki Template Tagline
<p style="font-size:12px;background-color:#a5e4fa;">Try to learn <b><i>something</i></b> about everything, and <b><i>everything</i></b> about something <br> <i> -Thomas Huxley “Darwin's bulldog” (1824-1895)</i></p>
Dokuwiki Timezone
- I noticed the timestamps on file creation/modification were in UTC
- I'd rather have “local time” so I don't have to think too hard
- The answer is here → https://www.dokuwiki.org/tips:timezone
- I used the first option, after successfully testing the second (editing
php.ini
) - I created
conf/local.protected.php
with
<?php date_default_timezone_set("Europe/London");
- I did
sudo chown www-data:www-data local.protected.php
too, just to be sure - All looks good - pages created/modified while in summer time show the time in
BST
and pages modified in winter time show the time inGMT
Add DW2PDF
- To allow export of pages from Wiki → PDF format install plugin dw2pdf
- to enable functionality it was necessary to install
php-mbstring
package on the VPSsudo apt-get install php-mbstring
sudo service apache2 restart
UPDATE
— John Pumford-Green 26/04/23 10:04
removed dw2pdf
plugin, it is largely unused and adds pointless bloat.
Increase maximum file size upload for Media Manager
- edit
php.ini
sudo vi /etc/php/XX/apache2/php.ini
- change
upload_max_filesize = 2M
toupload_max_filesize = 20M
- change
post_max_size = 2M
topost_max_size = 20M
sudo service apache2 restart
Allow any file-type upload
From https://forum.dokuwiki.org/d/3318-allow-upload-of-any-filetype/5
Edit /var/www/html/www/dokuwiki/inc/media.php
and comment out :
// because a temp file was created already //if (!preg_match('/\.(' . $regex . ')$/i', $fn)) { // return [$lang['uploadwrong'], -1]; //}
Acronyms & Abbreviations
I find the underlining and “explanation” of some abbreviations/acronyms by dokuwiki, when rendering a page, to be annoying.
The process is described HERE
To disable this I simply copied the default conf/acronyms.conf
to a local version conf/acronyms.local.conf
and then edited the local
version to remove all the explanations.
# Acronyms. ACL AFAICS AFAIK AFAIR API ASAP ASCII BTW CMS CSS DNS EOF EOL EOM EOT FAQ FTP FOSS FLOSS FUD FYI GB GHz GPL GUI HTML IANAL IE IIRC IMHO IMO IOW IRC IRL KISS LAN LGPL LOL MathML MB MHz MSIE OMG OS OSS OTOH PITA RFC ROTFL RTFM spec TIA TL;DR TOC URI URL W3C WTF? WYSIWYG YMMV
This supresses the annoyance.
— John Pumford-Green 30/04/23 13:49
Add folded plugin
make a clickable hide/reveal section with
++++ visible text | hidden text blah blah ++++
e.g.
Increase TAGCLOUD font size
edit /var/www/html/dokuwiki/lib/plugins/cloud/style.less
increase size factor
/* Size factor. */ @sF: 1.2;
force re-fresh of browser to show new font size.
Keyboard Plugin
- tweak the size, border and colour
example keys
Ctrl+C
Tweaks
/var/www/html/dokuwiki/lib/plugins/keyboard/all.css
kbd.__keyboard { color: #0000ff; background-color: #defede; text-align: center; border-left: 1px solid #cfcfcf; border-top: 1px solid #cfcfcf; border-right: 3px solid #666666; border-bottom: 3px solid #666666; -moz-border-radius: 4px 4px 4px 4px; padding-left: 3px; padding-top: 0px; padding-right: 3px; padding-bottom: 0px; margin-left: 2px; margin-right: 2px; vertical-align: top; font-family: sans-serif; white-space: nowrap; font-size: 1.2em; }
Dokuwiki Template monospace font
- the colour of the mono font is the same as general text and doesn't stand out as well as in other templates.
- edit
/var/www/html/dokuwiki/lib/tpl/dokuwiki/css/basic.less
with a hex code for a better colour- but see below for a better place to do the configuraiton
code { color: #c72522; font-size: 1.1em; padding: 0.1em 0.3em; border-radius: 0; }
- To prevent upgrades overwriting these changes - add them to
/var/www/html/dokuwiki/conf/userstyle.css
pre
relates to the blocks of <code> ////// </code>code
relates tomonospaced text
pre { border-radius: 10px; background-color: #fcffff } code { color: #c72522; font-size: 1.1em; padding: 0.1em 0.3em; border-radius: 0px; }
Remove Dokuwiki template footer buttons
- edit
/var/www/html/dokuwiki/lib/tpl/dokuwiki/tpl_footer.php
- comment out ( <!-- ///// --> ) the license stanza and/or the <div> that contains the “buttons”
<?php /** * Template footer, included in the main and detail files */ // must be run from within DokuWiki if (!defined('DOKU_INC')) die(); ?> <!-- ********** FOOTER ********** --> <div id="dokuwiki__footer"><div class="pad"> <!-- <?php tpl_license(''); // license text ?> --> <!-- <div class="buttons"> <?php tpl_license('button', true, false, false); // license button, no wrapper $target = ($conf['target']['extern']) ? 'target="'.$conf['target']['extern'].'"' : ''; ?> <a href="https://www.dokuwiki.org/donate" title="Donate" <?php echo $target?>><img src="<?php echo tpl_basedir(); ?>images/button-donate.gif" width="80" height="15" alt="Donate" /></a> <a href="https://php.net" title="Powered by PHP" <?php echo $target?>><img src="<?php echo tpl_basedir(); ?>images/button-php.gif" width="80" height="15" alt="Powered by PHP" /></a> <a href="//validator.w3.org/check/referer" title="Valid HTML5" <?php echo $target?>><img src="<?php echo tpl_basedir(); ?>images/button-html5.png" width="80" height="15" alt="Valid HTML5" /></a> <a href="//jigsaw.w3.org/css-validator/check/referer?profile=css3" title="Valid CSS" <?php echo $target?>><img src="<?php echo tpl_basedir(); ?>images/button-css.png" width="80" height="15" alt="Valid CSS" /></a> <a href="https://dokuwiki.org/" title="Driven by DokuWiki" <?php echo $target?>><img src="<?php echo tpl_basedir(); ?>images/button-dw.png" width="80" height="15" alt="Driven by DokuWiki" /></a> </div> --> </div></div><!-- /footer --> <?php tpl_includeFile('footer.html');
Bootstrap3 ThemeByNamespace
To force specific bootstrap/bootswatch
themes dependant on the namespace
- enable
ThemeByNamespace
option - create a file in
<dokuwiki>/conf
calledbootstrap3.themes.conf
chown www-data:www-data bootstrap3.themes.conf
- add the required theme/namespace mapping:
# Namespace Bootswatch Theme start bootswatch/darkly public bootswatch/darkly public:calculator bootswatch/slate public:journal bootswatch/journal private bootswatch/flatly playground bootswatch/united private:wire2waves bootswatch/paper blog bootswatch/yeti
- it seems necessary to disable
showThemeSwitcher
and to select a default theme to be used outside of any listed in the conf file
Vector / Monobook tweaks
I like the Vector and Monobook templates, very similar feel to Wikipedia
Logout errors with later versions of Dokuwiki
After upgrading Dokuwiki to Igor it became impossible to log out due to a warning
I initially ignored it but then downgraded back to Hogfather as there seemed to be no fix - other than to use a different template.
I recently upgraded to the latest Dokuwiki (Jack Jackrum), and upgraded all plugins and templates where possible. However the problem with logout with Vector and Monobook re-appeared.
I found there was a fix described on the forum:
https://forum.dokuwiki.org/d/20248-security-token-did-not-match-possible-csrf-attack-cannot-log-out
and the cure is to edit the appropriate line in main.php
for each template, as the author seems not to be maintaining these templates any more, at least not the official ones accessed via Dokuwiki's Template/Extension installer. The github repository shows that the fix has been applied to Vector
, and a pull request submitted to fix Monobook
, the fixes haven't appeared in the official versions.
The does work, though…
For Vector edit /var/www/html/dokuwiki/lib/tpl/vector/main.php
to add , 'sectok' ⇒ getSecurityToken()
in the array
statement after “do” ⇒ “logout”
echo " <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout", 'sectok' => getSecurityToken()))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core
and the same for Monobook
echo " <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout", 'sectok' => getSecurityToken()))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core
Monospace font
I found the style applied to monospace
text was a little underwhelming.
I found the place to change it:
/var/www/html/dokuwiki/lib/tpl/{vector|monobook}/user/screen.css
add the the following and adjust as needed:
div#content .dokuwiki code { font-size: 100%; padding-left: 5px; padding-right: 5px; background-color: #eee; color: #00f; direction: ltr; text-align: left; }
Footer Buttons
Remove the default footer buttons by editing {vector|monobook}/user/buttons.php
and adding
$_monobook_btns = array();
//delete all (defaults) $_vector_btns = array();
this suppresses the inclusion of footer buttons from vector/conf/buttons.php
Add just the Dokuwiki and Vector/Monobook Buttons
Edit {vector|monobook}/user/buttons.php
monobook
for vector
as appropriate
<?php //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //delete all (defaults) $_vector_btns = array(); //note: The buttons will be rendered in the order they were defined. Means: // first button will be rendered first, last button will be rendered at // last. //DokuWiki button $_vector_btns["dw"]["img"] = DOKU_TPL."static/img/button-dw.png"; $_vector_btns["dw"]["href"] = "https://www.dokuwiki.org/"; $_vector_btns["dw"]["width"] = 80; $_vector_btns["dw"]["height"] = 15; $_vector_btns["dw"]["title"] = "DokuWiki"; $_vector_btns["dw"]["nofollow"] = !(cleanID(getID()) === "start"); //"vector for DokuWiki" button $_vector_btns["vecfdw"]["img"] = DOKU_TPL."static/img/button-vector.png"; $_vector_btns["vecfdw"]["href"] = "https://www.dokuwiki.org/template:vector"; $_vector_btns["vecfdw"]["width"] = 80; $_vector_btns["vecfdw"]["height"] = 15; $_vector_btns["vecfdw"]["title"] = $lang["vector_mdtemplatefordw"]; $_vector_btns["vecfdw"]["nofollow"] = !(cleanID(getID()) === "start");
Mobile Scaling
The layout on a phone isn't too good, and can't be zoomed/scaled.
I found this thread:
https://forum.dokuwiki.org/d/12469-vector-template-doesn-t-display-correctly-on-mobile-devices/6
and applied the comment-out of the line :
//echo "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />";
in main.php
and mediamanager.php
the page now scales/zooms okay to make it useable on a phone.
Alternative
Using the loadskin
plugin
it's possible to switch to the default dokuwiki
template when on a mobile device and the vector
template when on a computer.
loadskin
plugin seems to lead to problems switching between monobook
and vector
- the navigation sidebar seems to disappear on one or the other. Not sure where the problem is.
Note Plugin
Various Coloured notes:
<note> This is my note ! Remember it!! </note> <note important> Warning ! You're about to lose your mind ;-) </note> <note tip> The clues are in the images. </note> <note warning> Beware of the cat when you open the door !! </note> ++++Note in a Folded section| <note warning> Ça fonctionne seulement avec le //div// pas le //span//. </note> ++++
Monobook Tweaks
PDF Export Tab
The dw2pdf
plugin provides a button on many templates to trigger export to PDF
but not on monobook
. It's possible to add a tab to the top of the page, beside the edit
etc. tabs, to do the the pdf export
function.
monobook/user/tabs.php
//PDF plugin: export tab if (file_exists(DOKU_PLUGIN."dw2pdf/action.php") && !plugin_isdisabled("dw2pdf")){ $_monobook_tabs["tab-export-pdf"]["text"] = "pdf export"; $_monobook_tabs["tab-export-pdf"]["href"] = wl(getID(), array("do" => "export_pdf"), false, "&"); }
Vector Interwiki Icons
The icon shown on interwiki links almost always appears as a small “lock” rather than the correct icon
commenting out the .link-https
section in /vector/static/3rd/vector/main-ltr.css
stops this :
div#content a.external, div#content a[href ^="gopher://"] { background: url(static/3rd/vector/external-link-ltr-icon.png) center right no-repeat; padding: 0 13px 0 0; } /* div#content a[href ^="https://"], .link-https { background: url(static/3rd/vector/lock-icon.png) center right no-repeat; padding: 0 13px 0 0; } */ div#content a[href ^="mailto:"], .link-mailto { background: url(static/3rd/vector/mail-icon.png) center right no-repeat; padding: 0 13px 0 0; }
Page Updated: 09/03/25 09:29 GMT