DokuWiki
Non-default Configurations
Use Nice URLs
After setting the Advanced → userewrite
option to .htaccess
, be sure to uncomment the corresponding rewrite rules
Stylistic Customisations
Most of the notes and tips in this section are specific to the Bootstrap3 template and make use of the various hooks it supports, however some of the following might also work with other templates.
Site logo and favicon
From https://www.dokuwiki.org/template:bootstrap3:customizations#change_the_logo_and_favicon, the site's logo, favicon and Apple Touch icon can be changed by uploading custom images to :logo.png
, :favicon.ico
and :apple-touch-icon.png
; although this page also mentions files of the same name in the :wiki
namespace, this doesn't seem to be necessary.
Links and Menus in the Navbar
Quick-links can be placed in the navbar after the site's name by defining an unordered list in :navbar
. Hierarchical menus are also supported, but as mentioned here, in order for them to work properly, parent menu items need to be 'text-only' (i.e. not links), otherwise the resulting downward triangles leads to less-than-desirable rendering and/or incorrect behaviour.
That said, it might also / still be possible to get things to work in the more usual way; from http://jsfiddle.net/brbcoding/tah2tur9/
<div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <ul class="nav"> <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Link</a> <ul class="dropdown-menu"> <li><a href="#">Link</a></li> <li><a href="#opening">Link</a></li> </ul> </li> </ul> </div> </div> </div>
@import url('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'); .container { margin-top: 10px; } .dropdown:hover .dropdown-menu { display: block; margin-top: 0; }
By way of an update, it looks like making a couple of changes to the getNavbar
function (and adding the above .dropdown:hover .dropdown-menu
style element might do the trick... (The one caveat is that now, any parent menu entries must be links, however I think this is a better problem to have.)
- lib/tpl/bootstrap3/Template.php
public function getNavbar() { if ($this->getConf('showNavbar') === 'logged' && !$_SERVER['REMOTE_USER']) { return false; } global $ID; global $conf; $navbar = $this->toBootstrapNav(tpl_include_page('navbar', 0, 1, $this->getConf('useACL')), 'navbar'); $navbar = str_replace('urlextern', '', $navbar); /** * $navbar = preg_replace('/<li class="level([0-9]) node"> (.*)/', * '<li class="level$1 node dropdown"><a href="#" class="dropdown-toggle" data-target="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">$2 <span class="caret"></span></a>', $navbar); */ $navbar = preg_replace('/<li class="level([0-9]) node">\s*<a(.*)<\/a>/', '<li class="level$1 node dropdown"><a class="dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false" $2 </a><a href="#" class="dropdown-toggle" data-target="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></a>', $navbar); /** * $navbar = preg_replace('/<li class="level([0-9]) node active"> (.*)/', * '<li class="level$1 node active dropdown"><a href="#" class="dropdown-toggle" data-target="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">$2 <span class="caret"></span></a>', $navbar); */ $navbar = preg_replace('/<li class="level([0-9]) node active">\s*<a(.*)<\/a>/', '<li class="level$1 node active dropdown"><a class="dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false" $2 </a><a href="#" class="dropdown-toggle" data-target="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></a>', $navbar); # FIX for Purplenumbers renderer plugin # TODO use Simple DOM HTML or improve the regex! if ($conf['renderer_xhtml'] == 'purplenumbers') { $navbar = preg_replace('/<li class="level1"> (.*)/', '<li class="level1 dropdown"><a href="#" class="dropdown-toggle" data-target="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">$1 <span class="caret"></span></a>', $navbar); } $navbar = preg_replace('/<ul class="(.*)">\n<li class="level2(.*)">/', '<ul class="dropdown-menu" role="menu">' . PHP_EOL . '<li class="level2$2">', $navbar); return $navbar; }
- userstyle-fragment.css
.navbar-default .navbar-nav>li:hover, .navbar-default .navbar-nav>li:focus, .navbar-default .navbar-nav>li>a:hover, .navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>.active, .navbar-default .navbar-nav>.active>a, .navbar-default .navbar-nav>.active>a:hover, .navbar-default .navbar-nav>.active>a:focus { background-color: #541818; border-color: #541818; display: inline-block; } .nav>li>a { display: inline-block; } .node .caret { margin-left: -15px; margin-right: 5px; }
conf/userstyle.css
To allow image galleries to be centered rather than left-aligned:
.gallery_center table { margin-left: auto; margin-right: auto; align: center; }
To disable the site-logo and remove its placeholder:
#dw__logo { display: none; }
conf/pageheader.html and pagefooter.html
For certain things, the :pageheader
and :pagefooter
pages cannot be used as they get interpreted pre-, rather than post-merging. As such, to 'wrap' the content of all wiki-content within a Bootstrap column, for example, one would need to place the following into the conf/pageheader.html
and conf/pagefooter.html
files instead:
- pageheader.html
<div class="bs-wrap bs-wrap-row row"> <div class="bs-wrap bs-wrap-col col-sm-1"></div> <div class="bs-wrap bs-wrap-col col-sm-10">
- pagefooter.html
</div> <div class="bs-wrap bs-wrap-col col-sm-1"></div> </div>
Plugin Customisations
vshare
Adding Support for an Nginx-based .onion Video Service
- install the
vshare
plugin from https://github.com/splitbrain/dokuwiki-plugin-vshare (not via the extension manager) - add the following to sites.ini
[onionsite] url = http://jhkakuiygoeu47vvuzks6mylhhmpns2aqz26immemfzodvrm6wihnvqd.onion/v/@VIDEO@.mp4 vid = 0GaDaQ3A1Cs web = http://jhkakuiygoeu47vvuzks6mylhhmpns2aqz26immemfzodvrm6wihnvqd.onion/v/0GaDaQ3A1Cs.mp4 rex = jhkakuiygoeu47vvuzks6mylhhmpns2aqz26immemfzodvrm6wihnvqd\.onion\/v\/(\S+)