mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2025-07-22 06:21:55 +00:00
#693, Hide ToC aside menu if table of contents is empty
This commit is contained in:
parent
81ff5e37d6
commit
92579b2c72
@ -33,7 +33,7 @@
|
||||
<label for="menu-control" class="hidden book-menu-overlay"></label>
|
||||
</div>
|
||||
|
||||
{{ if default true (default .Site.Params.BookToC .Params.BookToC) }}
|
||||
{{ if partial "docs/toc-show" . }}
|
||||
<aside class="book-toc">
|
||||
<div class="book-toc-content">
|
||||
{{ template "toc" . }} <!-- Table of Contents -->
|
||||
|
@ -6,7 +6,7 @@
|
||||
<h3>{{ partial "docs/title" . }}</h3>
|
||||
|
||||
<label for="toc-control">
|
||||
{{ if default true (default .Site.Params.BookToC .Params.BookToC) }}
|
||||
{{ if partial "docs/toc-show" . }}
|
||||
<img src="{{ "svg/toc.svg" | relURL }}" class="book-icon" alt="Table of Contents" />
|
||||
{{ end }}
|
||||
</label>
|
||||
|
5
layouts/_partials/docs/toc-show.html
Normal file
5
layouts/_partials/docs/toc-show.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{ return default true (
|
||||
and
|
||||
(default .Site.Params.BookToC .Params.BookToC)
|
||||
(not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>"))
|
||||
) }}
|
Loading…
Reference in New Issue
Block a user