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

github.com/htr3n/hyde-hyde.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerry Rod <tkstorm1988@gamil.com>2019-04-02 09:22:00 +0300
committerTerry Rod <tkstorm1988@gamil.com>2019-04-02 09:22:00 +0300
commit5427aefb1fe389ac3acea9e87e1dbe82ddc3c5af (patch)
tree5084f43a4c45e0a3faa91d15218cf4ef37faad2a
parent160b3d94005c7a7c2f5cb2d16d22c6ef3a64588c (diff)
add include_toc options in FrontMatter
-rw-r--r--layouts/partials/page-single/content.html21
-rw-r--r--layouts/partials/page-single/footer.html5
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({