add table of contents

This commit is contained in:
Huy Tran 2018-09-30 09:32:57 +10:00
parent 1b974ce9d3
commit b517159c0e
13 changed files with 161 additions and 23 deletions

View file

@ -5,9 +5,21 @@
<span class="post__subtitle">
{{.}}
</span>
{{ end }}
{{ end }}
{{ partial "page-single/post-meta.html" . }}
</header>
{{ $tableOfContents := .TableOfContents }}
{{ with .Site.Params.toc }}
<div class="toc-wrapper">
<input type="checkbox" id="tocToggle">
<label for="tocToggle">Table of Content</label>
{{ if eq . "hugo" }}
{{ $tableOfContents }}
{{ else if eq . "tocbot"}}
<div class="toc" id="TableOfContents"></div>
{{ end }}
</div>
{{ end }}
<div class="post">
{{ .Content }}
</div>