aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorTrack3 <34504964+Track3@users.noreply.github.com>2018-12-28 23:24:34 +0800
committerGitHub <noreply@github.com>2018-12-28 23:24:34 +0800
commitc7ebd82a83c4fd854407f9695d22c4d969cd49ca (patch)
treef05d3f1f73ae78a08932e788d565bb35ff7aa40c /layouts
parent1770524126121164f3b566fa74d88db536d644d3 (diff)
parent451d527ae61cc47bf11d63d3d03054384e1bd237 (diff)
downloadhermit-c7ebd82a83c4fd854407f9695d22c4d969cd49ca.tar.gz
Merge pull request #18 from Track3/feature-toc
Add support for Table of Contents
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/header.html3
-rw-r--r--layouts/posts/single.html6
2 files changed, 9 insertions, 0 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 7b04dd9..d89b018 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -14,6 +14,9 @@
{{ with .Params.featuredImg -}}
<button class="hdr-btn" onclick="showFeaturedImg()"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></button>
{{- end }}
+ {{- with .Params.toc -}}
+ <button class="hdr-btn desktop-only-ib" onclick="toggleToc()"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-list"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3" y2="6"></line><line x1="3" y1="12" x2="3" y2="12"></line><line x1="3" y1="18" x2="3" y2="18"></line></svg></button>
+ {{- end }}
{{- with .Site.Params.social -}}
<span class="hdr-social hide-in-mobile">{{ partialCached "social-icons.html" . }}</span>
{{- end -}}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index e8b37a8..c84c50c 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -32,6 +32,12 @@
{{- end }}
</footer>
</article>
+ {{- if .Params.toc }}
+ <aside id="toc">
+ <div class="toc-title">{{ i18n "tableOfContents" }}</div>
+ {{ .TableOfContents }}
+ </aside>
+ {{- end }}
<div class="post-nav thin">
{{- with .NextInSection }}
<a class="next-post" href="{{ .Permalink }}">