xref: /template/readthedokus/README.md (revision d381555c8fa95d60ef84d9ccfbc953b35bc607c9)
1# Read the Dokus - DokuWiki Template
2
3This is a DokuWiki theme that imitates "Read the Docs".
4
5![c7467c9c43ba585265cf829dd5d1c230 media](https://user-images.githubusercontent.com/49435291/164868953-d272c665-57e4-4c17-87c1-8b238b5ea5d3.png)
6
7## Featuring
8- “Read the Docs” appearance
9- Embedded foldable TOC in the sidebar
10- Auto generated “Previous”, “Next” buttons to follow the pages on the sidebar
11
12## Installation
13
14Use DokuWiki's Extention Manager to install the template. If you want to install manually, you can download from [here.](https://github.com/my17560/dokuwiki-template-readthedokus/archive/refs/heads/main.zip)
15
16## Settings
17
18### Template Settings ###
19
20These are template settings for this theme.
21
22|Option|Description|
23-------|------------
24|Sidebar position|Choose “left” for the left sidebar, “right” for the right sidebar.|
25|Use DokuWiki breadcrums|Check to use DokuWiki style breadcrumbs.|
26|Show toolbox even when logged out|Check to show the Toolbox always. By default, it is not shown unless you log in.|
27|Start Page|Set start page URL. This page is shown when the “previous” button is pressed on the first page.|
28|Enable Font Awesome|Check if you want to use Font Awesome. Don't forget to put the necessary tags in the option below. Technically, this option only puts the tags specified in the head tag.|
29|Specify a tag to include Font Awesome|Specify tags to include FontAwesome.The tags specified here are put in the head tag.|
30|Enable Google Fonts|Check if you want to use Google Fonts. Don't forget to put the necessary tags in the option below. Technically, this option only puts the tags specified in the head tag.|
31|Specify tags to include Google Fonts|Specify tags to include Google Fonts. The tags specified here are put in the head tag.|
32
33### Template Variables ###
34
35These are some of the options on "Template Style Settings". Other options are available to change various colors used in this template.
36
37|Option|Description|
38-------|------------
39|Site width|Width of the whole content including the sidebar. By setting this value, the contents will be centered.|
40|Content width|Content width. This is a maximum width so the actual size could be less than this value.|
41|Side bar width|Sidebar width.|
42|Header height|Header height. The theme puts padding on the top of the page according to this value.|
43|Footer height|Footer height. The theme puts padding on the bottom of the page according to this value.|
44|CSS breakpoint for smart phones|Screen size less than this value will be treated as a smartphone.|
45|CSS breakpoint for tablets|Screen size less than this value will be treated as a tablet. |
46
47## Notes
48
49### Sidebar Format ###
50
51Use strong for captions, and lists for items. Anything other than that won't be styled, so use your own styles for them.
52
53E.g.
54```
55** Caption1 **
56  * [[page1]]
57  * [[page2]]
58** Caption2 **
59  * page3
60  * page4
61```
62
63Some index plugins are supported by this template and can be used in the sidebar.
64
65- AcMenu Plugin
66- IndexMenu Plugin
67- nspages Plugin
68- simplenavi Plugin
69
70### Previous/Next Buttons ###
71
72Previous/Next buttons follow links to DokuWiki on the sidebar, picked up by using querySelector(".aside > #sidebar a[data-wiki-id]"). The previous button on the first page will jump to root(/) by default. You can change this in "Start Page" option in the settings.
73
74### Link to Login Page ###
75
76This theme doesn't have any links to the login page by default. Go directly to the login page by appending “&do=login” to the current URL. Or, check the “Show toolbox even when logged out” option in the settings to show the Toolbox always which has the link to the login page.
77
78### Admonitions ###
79
80This theme has "Read The Docs" style admonitions. To use them, wrap a content with a div that has a class "admonition" and a type.
81
82E.g.
83```
84<html><div class="admonition note">
85<p>Note!</p>
86</div></html>
87```
88
89Types are:
90- danger
91- caution
92- note
93- tip
94
95You can use "Wrap Plugin" to make it a bit simpler.
96
97```
98<WRAP admonition note>
99Note!
100</WRAP>
101```
102
103If you use the plugin, do not forget to add classes (admonition,danger,caution,note,tip) to the "noPrefix" in the Wrap plugin option otherwise admonitions will not be styled correctly.
104
105## Customization
106
107### Using Font Awesome ###
108
109Even though this theme works without Font Awesome, you can use Font Awesome for better looking. If you decide to use it, check the option in the configuration manager to enable it. Do not forget to set the correct tag in the following option.
110
111A home icon will appear beside the title, and +/- buttons on TOC, a mobile menu button will be replaced by Font Awesome.
112
113### Using Google Fonts ###
114
115Also, you can use google fonts for better looking. Lato and Robot fonts are set in font-family in this theme CSS. If you decide to use it, check the option in the configuration manager to enable it. Change the tags in the following option.
116
117### Adding a Fixed Header/Footer ###
118
119This theme supports a fixed header and footer. On the "Template Style Setting" page, enter a header height in the "Header height" option, a footer height in the "Footer height" option. The theme will add paddings according to those options on top for header, bottom for footer. You can put your own header/footer in "header.html"/"footer.html" in the "lib/tbl/readthedokus/" directory.
120
121#### 1. Set header/footer height in "Template Style Settings" ####
122
123These values must be valid CSS values.
124
125e.g. "50px"
126
127#### 2. Create header.html/footer.html ####
128
129Create a file "header.html"/"footer.html" under (DokuWiki folder)/lib/tpl/readthedokus/.
130
131Here is a sample header.html. This example also shows how to toggle a sidebar. Clicking the string "Header" toggles the sidebar.
132
133```
134<div onclick="toggleMenu();">Header</div>
135<style>
136header > div {
137	background-color: khaki;
138	position: fixed;
139	height: 50px;
140	left: 0;
141	top: 0;
142	right: 0;
143}
144</style>
145<script>
146function toggleMenu()
147{
148	dokus.toggleSidebar();
149}
150</script>
151```
152
153You might want to hide a mobile menu since both the sticky header and the mobile menu are displayed at the same time on mobile devices. To hide the mobile menu add below to the CSS file (DokuWiki folder)/conf/userall.css
154
155```
156#mobileheader {
157display: none;
158}
159```
160
161### Centering the Content ###
162
163To center the content, enter the content width in the "Site width" option on the "Template Style Settings".
164
165### Include Hooks ###
166
167The theme has some include-hooks.
168
169```
170+--------------------------------------------------+
171|                       [1]                        |
172+-------------+------------------------------------+
173|    Title    | Docs > Page Title                  |
174|(           )|                [6]                 |
175|     [2]     | ---------------------------------- |
176+-------------+                                    |
177|     [3]     |                                    |
178|             |                                    |
179|             |                                    |
180|             |                                    |
181|             |                                    |
182|             |                                    |
183|             |                                    |
184|             |                                    |
185|             |                                    |
186|     [4]     | <Previous                    Next> |
187+-------------+                                    |
188|     [5]     |                [7]                 |
189+-------------+------------------------------------+
190|                       [8]                        |
191+--------------------------------------------------+
192
193
194[1] ... header.html
195[2] ... sidebarheader.html
196[3] ... sidebartop.html
197[4] ... sidebarbottom.html
198[5] ... sidebarfooter.html
199[6] ... pageheader.html
200[7] ... pagefooter.html
201[8] ... footer.html
202```
203