add include_toc options in FrontMatter
This commit is contained in:
parent
160b3d9400
commit
5427aefb1f
2 changed files with 15 additions and 11 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
{{ $include_toc := .Params.include_toc}}
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
@ -10,6 +11,7 @@
|
||||||
</header>
|
</header>
|
||||||
{{ $tableOfContents := .TableOfContents }}
|
{{ $tableOfContents := .TableOfContents }}
|
||||||
{{ with .Site.Params.toc }}
|
{{ with .Site.Params.toc }}
|
||||||
|
{{ if ne $include_toc false }}
|
||||||
<div class="toc-wrapper">
|
<div class="toc-wrapper">
|
||||||
<input type="checkbox" id="tocToggle">
|
<input type="checkbox" id="tocToggle">
|
||||||
<label for="tocToggle">Table of Content</label>
|
<label for="tocToggle">Table of Content</label>
|
||||||
|
@ -20,6 +22,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
<div class="post">
|
<div class="post">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{{ $include_toc := .Params.include_toc}}
|
||||||
{{ if .Site.GoogleAnalytics }}
|
{{ if .Site.GoogleAnalytics }}
|
||||||
<!-- Google Analytics -->
|
<!-- Google Analytics -->
|
||||||
{{ template "_internal/google_analytics_async.html" . }}
|
{{ template "_internal/google_analytics_async.html" . }}
|
||||||
|
@ -5,8 +6,8 @@
|
||||||
{{ partial "footer/font-awesome-js.html" . }}
|
{{ partial "footer/font-awesome-js.html" . }}
|
||||||
{{ partial "highlight-js.html" . }}
|
{{ partial "highlight-js.html" . }}
|
||||||
{{ with .Site.Params.toc }}
|
{{ with .Site.Params.toc }}
|
||||||
{{ if eq . "tocbot" }}
|
{{ if and (eq . "tocbot") (ne $include_toc false) }}
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.js"></script>
|
<script src="/js/tocbot.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
if (tocbot) {
|
if (tocbot) {
|
||||||
tocbot.init({
|
tocbot.init({
|
||||||
|
|
Loading…
Reference in a new issue