diff options
author | Terry Rod <tkstorm1988@gamil.com> | 2019-04-02 09:22:00 +0300 |
---|---|---|
committer | Terry Rod <tkstorm1988@gamil.com> | 2019-04-02 09:22:00 +0300 |
commit | 5427aefb1fe389ac3acea9e87e1dbe82ddc3c5af (patch) | |
tree | 5084f43a4c45e0a3faa91d15218cf4ef37faad2a | |
parent | 160b3d94005c7a7c2f5cb2d16d22c6ef3a64588c (diff) |
add include_toc options in FrontMatter
-rw-r--r-- | layouts/partials/page-single/content.html | 21 | ||||
-rw-r--r-- | layouts/partials/page-single/footer.html | 5 |
2 files changed, 15 insertions, 11 deletions
diff --git a/layouts/partials/page-single/content.html b/layouts/partials/page-single/content.html index 2c1924b..f923216 100644 --- a/layouts/partials/page-single/content.html +++ b/layouts/partials/page-single/content.html @@ -1,3 +1,4 @@ +{{ $include_toc := .Params.include_toc}} <article> <header> <h1>{{ .Title }}</h1> @@ -10,15 +11,17 @@ </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> + {{ if ne $include_toc false }} + <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 }} {{ end }} <div class="post"> {{ .Content }} diff --git a/layouts/partials/page-single/footer.html b/layouts/partials/page-single/footer.html index 3e47ebe..90d7eed 100644 --- a/layouts/partials/page-single/footer.html +++ b/layouts/partials/page-single/footer.html @@ -1,3 +1,4 @@ +{{ $include_toc := .Params.include_toc}} {{ if .Site.GoogleAnalytics }} <!-- Google Analytics --> {{ template "_internal/google_analytics_async.html" . }} @@ -5,8 +6,8 @@ {{ partial "footer/font-awesome-js.html" . }} {{ partial "highlight-js.html" . }} {{ with .Site.Params.toc }} -{{ if eq . "tocbot" }} -<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.js"></script> +{{ if and (eq . "tocbot") (ne $include_toc false) }} +<script src="/js/tocbot.js"></script> <script type="text/javascript"> if (tocbot) { tocbot.init({ |