注意:所有自定义项目基于 DokuWiki 自带主题
默认主题我觉得已经非常好看而且实用了,还提供一个微调的后台。
我在那里调整了一下整站的宽度,把全站的宽度改成了 80%,侧边栏的宽度改为了 17%。
另外一项自定义设置就是加上多语言支持,对于同一个页面可以提供不同语言的版本。为了达到这个目的可以安装Translation Plugin 这个插件。
安装好插件后,在配置管理器里做相应设置,比如像我这样把翻译语言列表设置成 en ja
。
另外,为了像官网一样把语言选择器放在侧边栏的上方,还有一些额外的工作需要完成。
1. 创建一个名叫 sidebarheader.html
的文件,放在 $DOKU_ROOT/lib/tpl/dokuwiki/
目录下。
<?php $translation = plugin_load('helper','translation'); if ($translation) echo $translation->showTranslations(); ?>
2. 创建一个 CSS 文件名叫 userstyle.css
放在 $DOKU_ROOT/conf/
目录下。
.dokuwiki #dokuwiki__aside div.plugin_translation { float: none; text-align: center; border-bottom: 1px solid #ccc; padding-bottom: 1.4em; margin-bottom: 1.4em; } .dokuwiki #dokuwiki__aside div.plugin_translation select,.dokuwiki #dokuwiki__aside div.plugin_translation input { border: 1px solid #ccc; background-color: #fff; }
创建或者修改 conf/local.protected.php
这个文件,东京时间的示例如下:
<?php date_default_timezone_set("Asia/Tokyo");
基本上按照 URL Rewriting 上的思路,首先在配置管理器里选择 `.htaccess`,然后在 DokuWiki 的根目录下放入这个文件,内容如下:
## You should disable Indexes and MultiViews either here or in the ## global config. Symlinks maybe needed for URL rewriting. #Options -Indexes -MultiViews +FollowSymLinks ## make sure nobody gets the htaccess, README, COPYING or VERSION files <Files ~ "^([\._]ht|README$|VERSION$|COPYING$)"> <IfModule mod_authz_host> Require all denied </IfModule> <IfModule !mod_authz_host> Order allow,deny Deny from all </IfModule> </Files> ## Don't allow access to git directories <IfModule alias_module> RedirectMatch 404 /\.git </IfModule> ## Uncomment these rules if you want to have nice URLs using ## $conf['userewrite'] = 1 - not needed for rewrite mode 2 RewriteEngine on RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L] RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L] RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L] RewriteRule ^$ doku.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) doku.php?id=$1 [QSA,L] RewriteRule ^index.php$ doku.php ## Not all installations will require the following line. If you do, ## change "/dokuwiki" to the path to your dokuwiki directory relative ## to your document root. #RewriteBase /dokuwiki # ## If you enable DokuWikis XML-RPC interface, you should consider to ## restrict access to it over HTTPS only! Uncomment the following two ## rules if your server setup allows HTTPS. #RewriteCond %{HTTPS} !=on #RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
如果你像我一样使用了 bitnami/dokuwiki 这个 docker 镜像,可以做如下操作:
1. 进入正在使用的容器
docker exec -it dokuwiki_dokuwiki_1 bash
2. 修改 dokuwiki-vhost.conf 文件
sed -i 's/AllowOverride None/AllowOverride All/g' /opt/bitnami/apache/conf/vhosts/dokuwiki-vhost.conf
3. 下载 .htaccess 文件到指定位置
curl -L https://git.io/Jeo5c > /opt/bitnami/dokuwiki/.htaccess
4. 重启容器
docker-compose restart
实际上在 DokuWiki 的下载页面 提供了一些可选插件随安装包一揽子下载,想必这些插件都是非常不错、成熟的插件,另外在 DokuWikiに最初に入れるお勧めプラグイン这里也列举了一些安装初期推荐安装的插件,本站使用的插件如下: