diff options
author | lberki <lberki@users.noreply.github.com> | 2022-05-05 12:08:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 12:08:42 +0300 |
commit | c95051b93d756d5653ebe36a8f5f2d556b3843a0 (patch) | |
tree | 451aa9a3af1e363fbe239ceef35b9e58ba388d15 /layouts | |
parent | 93a5ae3a16c5654414af8c0c83699b165a2d2bcf (diff) |
Add table of contents
Add table of contents
See #64
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/single.html | 4 | ||||
-rw-r--r-- | layouts/partials/toc.html | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index dba8344..f5f6f6e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,7 +1,9 @@ {{ define "main" }} <main> - <div class="post"> + {{ partial "toc.html" . }} + + <div class="post"> {{ partial "single/post-info.html" . }} {{ partial "single/title.html" . }} diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html new file mode 100644 index 0000000..81d524a --- /dev/null +++ b/layouts/partials/toc.html @@ -0,0 +1,13 @@ +{{ if .Params.toc }} +<aside class="toc"> + <script src="{{ "js/toc.js" | relURL }}"></script> + <div id="tocContainer"> + <div id="tocTitle"> + ☰ <!-- Trigram for heaven, aka. hamburger menu --> + </div> + <div id="tocCollapsible"> + {{ .TableOfContents }} + </div> + </div> +</aside> +{{ end }} |