Add default TOC template.

This commit is contained in:
tastytea 2020-12-27 22:19:01 +01:00
parent 2dfa7a6f78
commit c7884a8b80
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 15 additions and 10 deletions

View File

@ -41,10 +41,14 @@ template `extra-head.html` or above the footer by overwriting
`layouts/partials/extra_head.html` or `layouts/partials/extra_foot.html`,
respectively.
To add a TOC to your pages, add `layouts/partials/toc.html` as described in
link:{uri-hugo-doc-toc}[the Hugo documentation].
If you want source code highlighting, take a look at
link:{uri-tomorrow-pygments}[tomorrow-pygments].
== Good to know
Table of contents are only written when the word count exceeds 400 and the `toc`
field in your contents front matter is set to true. See
link:{uri-hugo-doc-toc}[the Hugo documentation] for details. You can overwrite
the template by adding the file `layouts/partials/toc.html` to your blog.
include::{uri-base}/raw/branch/main/CONTRIBUTING.adoc[]

View File

@ -1 +1,8 @@
<!-- You can overwrite this partial to add a TOC. See <https://gohugo.io/content-management/toc>. -->
{{ if and (gt .WordCount 400 ) (.Params.toc) }}
<aside class="toc">
<header>
<h2>Table of contents</h2>
</header>
{{.TableOfContents}}
</aside>
{{ end }}

View File

@ -129,12 +129,6 @@ div.admonitionblock td
margin-top: 2em;
}
/* Table of contents */
#toc ul
{
margin-top: 0;
}
textarea, pre
{
overflow: auto;