DokuWikiの表示画面を決めるのはテンプレートである。
もちろん標準のテンプレートでも良いのだが、サイドバーが欲しかったり、色を変えたり、デザイン自体を変更したい場合に、気に入ったテンプレートを利用する事によって、見栄えも随分変化する。
なお本ページは、arcticテンプレートを修正した物を利用している。
DokuWikiサイトにあるほとんどのテンプレートを試してみたが、結局以下の3つだけ残った。
筆者の要件として、
というものがあったため、サイドバーのカスタマイズがかなり細かく可能そうなarcticを利用する事にする。
テンプレートは、DokuWiki Templateに大量に掲載されているので、そこを参照。
テンプレートは、some/where/dokuwiki-dir/lib/tplに設置する。
some/where/dokuwiki-dir/lib/tplにコピーする。arcticは非常に色々な調整が出来るテンプレートなので、個人の好みに合うように調整することが非常に簡単だった。
基本的な事は、全てtemplate:arcticに書かれている。
しかし、日本語ではないので、ちょっとだけ敷居が高そうとも思うので、少しだけ設定を書いておく。
ページデザイン(ページスタイル)の変更には、直接ファイルを変更する必要がある。
some/where/dokuwiki-dir/lib/tpl/arctic/style.iniを修正すれば、色やページサイズの調整が可能である。
ちなみに「ほほほのほ」は、以下の設定を行った。この設定は、基本的に背景をグリーンにするものである。
あとはその他の文字が見やすいように調整をしただけとなっている。
; ARCTIC-TEMPLATE-DEFAULT-STYLE.INI ; @author: Michael Klier <chi@chimeric.de> ; Please see http://www.php.net/manual/en/function.parse-ini-file.php ; for limitations of the ini format used here ; Define the stylesheets your template uses here. The second value ; defines for which output media the style should be loaded. Currently ; print, screen and rtl are supported. rtl styles are loaded additionally ; to screen styles if a right-to-left language is selected (eg. hebrew) [stylesheets] layout.css = screen arctic_layout.css = screen design.css = screen arctic_design.css = screen style.css = screen media.css = screen arctic_media.css = screen rtl.css = rtl arctic_rtl.css = rtl print.css = print arctic_print.css = print ; This section is used to configure some placeholder values used in ; the stylesheets. Changing this file is the simplest method to ; give your wiki a new look. [replacements] ; arctic template LAYOUT __wiki_width__ = "98%" ; 84% __header_height__ = "5em" __body_margin__ = "1em" ; 1.5em __page_padding__ = "0.5em;" __footer_padding__ = "2em" ; arctic template FONT-SIZES AND FONT-COLORS __font_size__ = "0.8125em" __line_height__ = "150%" __pagename_color__ = "#ffefff" ; #f8f8f8 __logo_color__ = "#ffefff" ; #f8f8f8 __headline_color__ = "#000" ; #333 ; arctic template LAYOUT-COLORS __body_background__ = "#c0ffc0" ; #f8f8f8 __header_background__ = "#002f00" ; #436976 __footer_background__ = "#002f00" ; #436976 __form_border__ = "#008000" ; #efffef ;-------------------------------------------------------------------------- ;------ guaranteed dokuwiki color placeholders that every plugin can use ; main text and background colors __text__ = "#333" __background__ = "#efe" ; #fff ; alternative text and background colors __text_alt__ = "#638c9c" __background_alt__ = "#dee7ec" ; neutral text and background colors __text_neu__ = "#666" __background_neu__ = "#f5f5f5" ; border color __border__ = "#ccc" ;-------------------------------------------------------------------------- ; other text and background colors __text_other__ = "#ccc" __background_other__ = "#f7f9fa" ; these are used for links __extern__ = "#2828a0" ; #436976 __existing__ = "#5050e0" ; #56b04f __missing__ = "#e05050" ; #ed5353 ; highlighting search snippets __highlight__ = "#ff9" ;-------------------------------------------------------------------------- ;------ for keeping old templates and plugins compatible to the old pattern ; (to be deleted at the next or after next release) __white__ = "#fff" __lightgray__ = "#f5f5f5" __mediumgray__ = "#ccc" __darkgray__ = "#666" __black__ = "#000" ; these are the shades of blue __lighter__ = "#f7f9fa" __light__ = "#eef3f8" __medium__ = "#dee7ec" __dark__ = "#8cacbb" __darker__ = "#638c9c" ; setup vim: ts=2 sw=2:
画面表示の調整だが、一般に英語はjustifyすることが望ましい場合が多い。 しかし、日本語ページが中心である場合、justifyされると見た目が汚くなってしまうことが多い。 そこで、以下のファイル中にあるjustify宣言をコメントアウトする。
サイドバーのサイズを画面全体の横幅に対して15%に設定した。 これは、好みの問題もあるのであまりお勧めはしないが、やり方だけは書いておく。
div.dokuwiki div.left_sidebar {
float: left;
width: 15%; /* Original: 22% */
padding: 0.2em 0.5em 0 0;
border-right: 1px solid __border__;
}
div.dokuwiki div.right_sidebar {
float: right;
width: 15%; /* Original: 22% */
padding: 0.2em 0em 0 0.5em;
border-left: 1px solid __border__;
}
div.dokuwiki div.left_page,
div.dokuwiki div.right_page {
/* text-align: justify; */ /* これはjustifyを削除したため。 */
float: left;
width: 80% !important; /* Original: 72% */
width: 78%; /* Original: 69% */
padding: 2%;
}
div.dokuwiki div.center_page {
/* text-align: justify; */
float: left;
width: 64% !important; /* Original: 49% */
width: 62%; /* Original: 47% */
padding: 2% !important;
padding: 1%;
}
これで、サイドバーのサイズは15%に変更される。
sidebarの大きさを変えたので、検索フィールドが不格好になってしまった。
sidebarから検索フィールドを切り離せばいいのかもしれないが、それよりはサイズを変更する方が簡単だったので、そちらで対応。
some/where/dokuwiki-dir/conf/userstyle.cssを作成
div.dokuwiki #qsearch__in {
width: 65%;
}
sidebarは役割によって作成される名前空間が異なる。
これだけ判っていれば恐らく大丈夫だと思われる。
例えば、このページのサイドバーは以下のような内容になっている。
====== Site Contents Index ======
~~NOCACHE~~
* [[:Diary|日記]]
* [[:diaryidx|日記の目次]]
{{indexmenu>os#1|js#bj-tango.png navbar nocookie id#random tsort msort}}
{{indexmenu>serverapp#1|js#bj-tango.png navbar nocookie id#random tsort msort}}
* [[:Tips|Tips]]
* [[http://www.dokuwiki.org/%3Aja%3Asyntax|Wiki構文]]
{{indexmenu>wiki|js#bj-tango.png navbar nocookie id#random tsort msort}}