Skip to content

Commit b78d1df

Browse files
Merge branch 'main' into right-hand-tocbot
2 parents 8b2db7b + 6488360 commit b78d1df

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

userguide/content/en/docs/adding-content/lookandfeel.md

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -213,32 +213,6 @@ site's [configuration file][].
213213
[configuration file]: https://gohugo.io/getting-started/configuration/#configuration-file
214214
[primary color]: #site-colors
215215

216-
## Sidebar table of contents
217-
218-
By default, Docsy shows the table of contents for the current page in the right sidebar using the built-in function of Hugo. You can replace that with a JavaScript-based ToC that uses the [https://tscanlin.github.io/tocbot/](Tocbot library) by setting the following in your `config.toml` file:
219-
220-
```toml
221-
[params.jstoc]
222-
enable = true
223-
```
224-
225-
By default, h2-h4 headings are included in the sidebar, which includes tips and warnings if you are using the [alert shortcode of Docsy](/docs/adding-content/shortcodes/#alert). To change that,
226-
provide a comma-separated list of the headings to include in the `custom_headings` parameter, for example:
227-
228-
```toml
229-
[params.jstoc]
230-
enable = true
231-
custom_headings = "h2, h3"
232-
```
233-
234-
Compared to the default sidebar ToC, this solution:
235-
236-
- has a marker that shows the current location of the screen (useful for long pages)
237-
- shows the correct title even if the title contains a shortcode
238-
- shows the title in the toc even if it was included from another file
239-
240-
![Screenshot of JavaScript-based sidebar table of contents](/images/sidebar-toc-with-tocbot.png)
241-
242216
## Customizing templates
243217

244218
### Add code to head or before body end
@@ -283,3 +257,28 @@ Both `head.html` and `scripts.html` are then used to build Docsy's [base page la
283257
</html>
284258
```
285259

260+
## Sidebar table of contents
261+
262+
By default, Docsy shows the table of contents for the current page in the right sidebar using the built-in function of Hugo. You can replace that with a JavaScript-based ToC that uses the [https://tscanlin.github.io/tocbot/](Tocbot library) by setting the following in your `config.toml` file:
263+
264+
```toml
265+
[params.jstoc]
266+
enable = true
267+
```
268+
269+
By default, h2-h4 headings are included in the sidebar, which includes tips and warnings if you are using the [alert shortcode of Docsy](/docs/adding-content/shortcodes/#alert). To change that,
270+
provide a comma-separated list of the headings to include in the `custom_headings` parameter, for example:
271+
272+
```toml
273+
[params.jstoc]
274+
enable = true
275+
custom_headings = "h2, h3"
276+
```
277+
278+
Compared to the default sidebar ToC, this solution:
279+
280+
- has a marker that shows the current location of the screen (useful for long pages)
281+
- shows the correct title even if the title contains a shortcode
282+
- shows the title in the toc even if it was included from another file
283+
284+
![Screenshot of JavaScript-based sidebar table of contents](/images/sidebar-toc-with-tocbot.png)

0 commit comments

Comments
 (0)