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

github.com/heyeshuang/hugo-theme-tokiwa.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Yeshuang <yeshuanghe@gmail.com>2020-06-20 16:49:36 +0300
committerHe Yeshuang <yeshuanghe@gmail.com>2020-06-20 16:49:36 +0300
commit7394031c54d66e6285b4dcc041651a9125a0ff50 (patch)
treea0b2acbe50930716a0b4e2f686c328bc68687499 /layouts/partials
parent3df24a82173e10f6b9b1a59f7e588a3e38fb3c97 (diff)
add 'table of contents' feature
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/page-header.html1
-rw-r--r--layouts/partials/toc.html10
2 files changed, 11 insertions, 0 deletions
diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html
index e66b019..6aeb563 100644
--- a/layouts/partials/page-header.html
+++ b/layouts/partials/page-header.html
@@ -16,4 +16,5 @@
{{- .Date.Format "2006-1-2 15:04" -}}
</time>
</div>
+{{ partial "toc.html" . }}
<hr /> \ No newline at end of file
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
new file mode 100644
index 0000000..1c6b5e0
--- /dev/null
+++ b/layouts/partials/toc.html
@@ -0,0 +1,10 @@
+{{ if (.Params.toc) }}
+<details class="toc" open>
+<summary>
+ <hr />
+</summary>
+<div class="inline toc-content">
+ {{.TableOfContents}}
+</div>
+</details>
+{{ end }} \ No newline at end of file