Make sure ToC is showed in terms, set bookToC to be none by default

This commit is contained in:
Alex Shpak
2025-09-10 06:43:58 +02:00
parent ac32260c64
commit 3d55d45223
6 changed files with 25 additions and 22 deletions
+2 -2
View File
@@ -81,10 +81,10 @@ enableGitInfo = true
# Theme 'auto' switches between dark and light modes based on browser/os preferences
BookTheme = 'light'
# (Optional, default true) Controls table of contents visibility on right side of pages.
# (Optional, default none) Controls table of contents visibility on right side of pages.
# Start and end levels can be controlled with markup.tableOfContents setting.
# You can also specify this parameter per page in front matter.
BookToC = true
# BookToC = true
# (Optional, default favicon.png) Set the path to a favicon file.
# If the favicon is /static/favicon.png then the path would be favicon.png
+2 -2
View File
@@ -69,10 +69,10 @@ params:
# Theme 'auto' switches between dark and light modes based on browser/os preferences
BookTheme: "light"
# (Optional, default true) Controls table of contents visibility on right side of pages.
# (Optional, default none) Controls table of contents visibility on right side of pages.
# Start and end levels can be controlled with markup.tableOfContents setting.
# You can also specify this parameter per page in front matter.
BookToC: true
# BookToC: true
# (Optional, default favicon.png) Set the path to a favicon file.
# If the favicon is /static/favicon.png then the path would be favicon.png
+3 -3
View File
@@ -1,4 +1,4 @@
{{ return and
(default .Site.Params.BookToC .Params.BookToC | default true)
(not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>"))
{{ return default
(not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>"))
(default .Site.Params.BookToC .Params.BookToC)
}}
+8
View File
@@ -14,6 +14,14 @@
{{ template "_internal/pagination.html" . }}
{{ end }}
{{ define "toc-container" }}
<aside class="book-toc">
<div class="book-toc-content">
{{ template "toc" . }}
</div>
</aside>
{{ end }}
{{ define "toc" }}
{{ partial "docs/taxonomy" . }}
{{ end }}
-13
View File
@@ -1,13 +0,0 @@
{{ define "main" }}
<article class="markdown book-post">
<h1>{{ .Title | title }}</h1>
{{ $taxonomies := index .Site.Taxonomies .Page.Type }}
{{ range $taxonomies }}
<div><a href="{{ .Page.Permalink }}">{{ .Page.Title }} <sup>{{ .Count }}</sup></a></div>
{{ end }}
</article>
{{ end }}
{{ define "toc" }}
{{ partial "docs/taxonomy" . }}
{{ end }}
+10 -2
View File
@@ -5,15 +5,23 @@
<a href="{{ .RelPermalink }}">{{ partial "docs/title.html" . }}</a>
</h2>
{{ partial "docs/post-meta" . }}
<p>
<div class="book-post-content">
{{- .Summary -}}
</p>
</div>
</article>
{{ end }}
{{ template "_internal/pagination.html" . }}
{{ end }}
{{ define "toc-container" }}
<aside class="book-toc">
<div class="book-toc-content">
{{ template "toc" . }}
</div>
</aside>
{{ end }}
{{ define "toc" }}
{{ partial "docs/taxonomy" . }}
{{ end }}