xref: /template/readthedokus/README.md (revision accba9660e7770d707019d049a90eba1b1e21eb1)
1# Read the Dokus - Dokuwiki Template
2
3This is a theme that imitates "Read the Docs".
4
5Featuring:
6- “Read the Docs” appearance
7- Embedded foldable TOC in the sidebar
8- Auto generated “Previous”, “Next” buttons to follow the pages on the sidebar
9
10## Installtion
11
12Use 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)
13
14## Settings
15
16### Template settings ###
17
18These are template settings for this theme.
19
20|Option|Description|
21-------|------------
22|Sidebar position|"left" for left sidebar, "right" for right sidebar. |
23|Use Dokuwiki breadcrums|Use Dokuwiki style breadcrumbs.|
24|Start Page|Set start page url.|
25
26### Template variables ###
27
28These are some of the options on "Template Style Settings".
29
30|Option|Description|
31-------|------------
32|Site width|Width of the whole content including the sidebar. By setting this value, the contents will be centered.|
33|Content width|Content width. This is a maximum width so the actual size could be less than this value.|
34|Side bar width|Sidebar width.|
35|Header height|Header height. The theme puts padding on the top of the page according to this value.|
36|Footer height|Footer height. The theme puts padding on the bottom of the page according to this value.|
37|CSS breakpoint for smart phones|Screen size less than this value will be treated as a smartphone.|
38|CSS breakpoint for tablets|Screen size less than this value will be treated as a tablet. |
39
40## Notes
41
42#### Sidebar format ####
43
44Use strong for captions, lists of links for items. Anything other than that won't be styled, so use your own styles for them.
45
46E.g.
47```
48** Caption1 **
49  * [[page1]]
50  * [[page2]]
51** Caption2 **
52  * [[page3]]
53  * [[page4]]
54```
55
56#### Previous/Next buttons ####
57
58Previous/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.
59
60#### No link to login page ####
61
62This theme doesn't have any links to the login page. Go directly to the login page by appending "&do=login" to the current URL.
63
64#### Admonitions ####
65
66This theme has "Read The Docs" style admonitions. To use them, wrap a content with a div that has a class "admonition" and a type.
67
68E.g.
69```
70<html><div class="admonition note">
71<p>Note!</p>
72</div></html>
73```
74
75Types are:
76- danger
77- caution
78- note
79- tip
80
81You can use "Wrap Plugin" to make it a bit simpler.
82
83```
84<WRAP admonition note>
85Note!
86</WRAP>
87```
88
89If you use the plugin, do not forget to add classes to the "noPrefix" plugin option otherwise admonitions will not be styled correctly. You need to add four types listed above and "admonition" to the option value.
90
91## Customization
92
93### Using Font Awesome ###
94
95Even 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.
96
97A home icon will appear beside the title, and +/- buttons on TOC, a mobile menu button will be replaced by Font Awesome.
98
99### Using Google Fonts ###
100
101Also, 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.
102
103### Adding a fixed header/footer ###
104
105This 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.
106
107#### 1. Set header/footer height in "Template Style Settings" ####
108
109These values must be valid css values.
110
111e.g. "50px"
112
113#### 2. Create header.html/footer.html ####
114
115Create a file "header.html"/"footer.html" under (dokuwiki folder)/lib/tpl/readthedokus/.
116
117Here is a sample header.html. This example also shows how to toggle a sidebar. Clicking the string "Header" toggles the sidebar.
118
119```
120<div onclick="toggleMenu();">Header</div>
121<style>
122header > div {
123	background-color: khaki;
124	position: fixed;
125	height: 50px;
126	left: 0;
127	top: 0;
128	right: 0;
129}
130</style>
131<script>
132function toggleMenu()
133{
134	dokus.toggleSidebar();
135}
136</script>
137```
138
139You 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 CSS file (dokuwiki folder)/conf/userall.css
140
141```
142#mobileheader {
143display: none;
144}
145```
146
147### Centering the content ###
148
149To center the content, enter the content width in the "Site width" option on the "Template Style Settings".
150
151### Include Hooks ###
152
153The theme has some include-hooks.
154
155```
156+--------------------------------------------------+
157|                       [1]                        |
158+-------------+------------------------------------+
159|    Title    | Docs > Page Title                  |
160|(           )|                [6]                 |
161|     [2]     | ---------------------------------- |
162+-------------+                                    |
163|     [3]     |                                    |
164|             |                                    |
165|             |                                    |
166|             |                                    |
167|             |                                    |
168|             |                                    |
169|             |                                    |
170|             |                                    |
171|             |                                    |
172|     [4]     | <Previous                    Next> |
173+-------------+                                    |
174|     [5]     |                [7]                 |
175+-------------+------------------------------------+
176|                       [8]                        |
177+--------------------------------------------------+
178
179
180[1] ... header.html
181[2] ... sidebarheader.html
182[3] ... sidebartop.html
183[4] ... sidebarbottom.html
184[5] ... sidebarfooter.html
185[6] ... pageheader.html
186[7] ... pagefooter.html
187[8] ... footer.html
188```
189