Table of Contents
This commit is contained in:
parent
f6769864be
commit
f9cd1790d6
12
README.md
12
README.md
@ -12,6 +12,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
|
|||||||
- Pagination
|
- Pagination
|
||||||
- Multiple taxonomies: tags, categories, authors
|
- Multiple taxonomies: tags, categories, authors
|
||||||
- Archive
|
- Archive
|
||||||
|
- Table of Contents
|
||||||
- Open Graph and Twitter Cards support
|
- Open Graph and Twitter Cards support
|
||||||
- Mobile support
|
- Mobile support
|
||||||
- Social icons
|
- Social icons
|
||||||
@ -99,6 +100,8 @@ params:
|
|||||||
readMore: false # show read more button
|
readMore: false # show read more button
|
||||||
readNextPosts: 5 # show 5 related posts, 0 by default
|
readNextPosts: 5 # show 5 related posts, 0 by default
|
||||||
disableSummary: false
|
disableSummary: false
|
||||||
|
toc: true # display Table of Contents
|
||||||
|
tocWordCount: 300 # ...when a post is longer than 300 words
|
||||||
copyCodeButton: true # true by default
|
copyCodeButton: true # true by default
|
||||||
rssAsSocialIcon: true
|
rssAsSocialIcon: true
|
||||||
mathjax: false # https://www.mathjax.org/
|
mathjax: false # https://www.mathjax.org/
|
||||||
@ -165,6 +168,15 @@ Options:
|
|||||||
- `dark` - dark theme by default, can be switched by user to light theme and back. Theme settings are saved for user
|
- `dark` - dark theme by default, can be switched by user to light theme and back. Theme settings are saved for user
|
||||||
- `auto` - theme based on user system settings by default, can be switched by user to dark/light theme. Theme settings are saved for user (by default in example sites)
|
- `auto` - theme based on user system settings by default, can be switched by user to dark/light theme. Theme settings are saved for user (by default in example sites)
|
||||||
|
|
||||||
|
### Table of Contents
|
||||||
|
If `toc` param in `params` section of the config file is set to `true`,
|
||||||
|
Table of Contents is generated for every post that is at least `tocWordCount`
|
||||||
|
words long (`0` by default, also belongs to the `params` section of the config).
|
||||||
|
|
||||||
|
This behavior can be overridden on per-post basis
|
||||||
|
by setting `toc` to either `true` or `false` in the front matter of a post.
|
||||||
|
|
||||||
|
|
||||||
### Social icons
|
### Social icons
|
||||||
#### Predefined icons
|
#### Predefined icons
|
||||||
To add icon from predefined list, add to `params.social` config:
|
To add icon from predefined list, add to `params.social` config:
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
{{ partial "post-language-switcher.html" . }}
|
{{ partial "post-language-switcher.html" . }}
|
||||||
</header>
|
</header>
|
||||||
</div>
|
</div>
|
||||||
|
{{ partial "toc.html" .}}
|
||||||
<div class="content e-content">
|
<div class="content e-content">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
|
9
layouts/partials/toc.html
Normal file
9
layouts/partials/toc.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{{ $toc := and ($.Site.Params.toc) (ge .WordCount $.Site.Params.tocWordCount) }}
|
||||||
|
|
||||||
|
{{ if isset .Params "toc" }}
|
||||||
|
{{ $toc = .Params.toc }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if $toc }}
|
||||||
|
{{ .TableOfContents }}
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue
Block a user