Merge pull request #68 from tkstorm/master

add include_toc options
This commit is contained in:
Huy Tran 2019-04-17 19:22:56 +07:00 committed by GitHub
commit cbc21e8492
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View file

@ -82,6 +82,8 @@ __`Hyde-hyde`__ essentially inherits most of Hyde's [options](https://github.com
github = "htr3n" github = "htr3n"
... ...
``` ```
* `include_toc = false`: Setting to `false` in FrontMatter will disable too short TOC data as your want.
* Per PR [#56](https://github.com/htr3n/hyde-hyde/commit/5ed13e17400bbc09a342b60fd50cd9fe3e6f1525), Gravatar pics can be used exclusively to `.Site.Params.authorimage` via the parameter `.Site.Params.social.gravatar` * Per PR [#56](https://github.com/htr3n/hyde-hyde/commit/5ed13e17400bbc09a342b60fd50cd9fe3e6f1525), Gravatar pics can be used exclusively to `.Site.Params.authorimage` via the parameter `.Site.Params.social.gravatar`

View file

@ -1,3 +1,4 @@
{{ $include_toc := .Params.include_toc}}
<article> <article>
<header> <header>
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
@ -10,15 +11,17 @@
</header> </header>
{{ $tableOfContents := .TableOfContents }} {{ $tableOfContents := .TableOfContents }}
{{ with .Site.Params.toc }} {{ with .Site.Params.toc }}
<div class="toc-wrapper"> {{ if ne $include_toc false }}
<input type="checkbox" id="tocToggle"> <div class="toc-wrapper">
<label for="tocToggle">Table of Content</label> <input type="checkbox" id="tocToggle">
{{ if eq . "hugo" }} <label for="tocToggle">Table of Content</label>
{{ $tableOfContents }} {{ if eq . "hugo" }}
{{ else if eq . "tocbot"}} {{ $tableOfContents }}
<div class="toc" id="TableOfContents"></div> {{ else if eq . "tocbot"}}
{{ end }} <div class="toc" id="TableOfContents"></div>
</div> {{ end }}
</div>
{{ end }}
{{ end }} {{ end }}
<div class="post"> <div class="post">
{{ .Content }} {{ .Content }}

View file

@ -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,7 +6,7 @@
{{ 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="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.js"></script>
<script type="text/javascript"> <script type="text/javascript">
if (tocbot) { if (tocbot) {