Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/EmielH/tale-hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlberki <lberki@users.noreply.github.com>2022-05-05 12:08:42 +0300
committerGitHub <noreply@github.com>2022-05-05 12:08:42 +0300
commitc95051b93d756d5653ebe36a8f5f2d556b3843a0 (patch)
tree451aa9a3af1e363fbe239ceef35b9e58ba388d15 /layouts
parent93a5ae3a16c5654414af8c0c83699b165a2d2bcf (diff)
Add table of contents
Add table of contents See #64
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/partials/toc.html13
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">
+ &#9776; <!-- Trigram for heaven, aka. hamburger menu -->
+ </div>
+ <div id="tocCollapsible">
+ {{ .TableOfContents }}
+ </div>
+ </div>
+</aside>
+{{ end }}