about summary refs log tree commit diff
path: root/layouts
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2023-08-04 15:19:35 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2023-08-04 15:19:35 +0700
commit743ec02a6980c4ee0fbd9f2cb5f23b568dc6d706 (patch)
tree3d9efae1a8b3c3724844cece5d4e4c13c2ca9331 /layouts
parentb472b8a7485a560740000f945f6e2fef3829fbb5 (diff)
downloadvictor-743ec02a6980c4ee0fbd9f2cb5f23b568dc6d706.tar.gz
Check site params only books
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html2
-rw-r--r--layouts/_default/list.html4
-rw-r--r--layouts/partials/breadcrumbs.html6
-rw-r--r--layouts/partials/head.html2
-rw-r--r--layouts/partials/root-toc.html4
-rw-r--r--layouts/partials/toc.html11
6 files changed, 14 insertions, 15 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 86a13fe..f53932d 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -9,7 +9,7 @@ SPDX-License-Identifier: MIT
 <html lang="{{ .Page.Language.Lang }}">
 <head>
     {{ block "head" . }}
-        {{ partialCached "head.html" . }}
+        {{ partial "head.html" . }}
     {{ end }}
 </head>
 <body>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 0f104a4..6dbd464 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -8,10 +8,10 @@ SPDX-License-Identifier: MIT
   <section class="index-content" id="main">
     {{ .Content }}
   </section>
-  {{ if in .Params.categories "book" }}
+  {{ if or .Site.Params.OnlyBooks (in .Params.categories "book") }}
   {{ partial "post-navigation-top.html" . }}
   <section class="toc">
-    {{ partial "toc.html" (dict "content" . "currentLink" .RelPermalink) }}
+    {{ partial "toc.html" . }}
   </section>
   {{ else if in .Params.categories "blog" }}
     {{ partial "feed.html" . }}
diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html
index 04c4ac3..c4fcef4 100644
--- a/layouts/partials/breadcrumbs.html
+++ b/layouts/partials/breadcrumbs.html
@@ -1,6 +1,10 @@
+{{ $crumbs := .Ancestors.Reverse }}
+{{ if not .Site.Params.OnlyBooks }}
+{{ $crumbs = where $crumbs "Params.categories" "intersect" (slice "book") }}
+{{ end }}
 <nav aria-label="breadcrumb" class="breadcrumb">
   <ol>
-    {{ range where .Ancestors.Reverse "Params.categories" "intersect" (slice "book") }}
+    {{ range $crumbs }}
       <li>
         <a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
       </li>
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index cfacfb9..9775e90 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -9,7 +9,7 @@
 {{ end }}
 
 {{ range .Ancestors }}
-{{ if in .Params.categories "book" }}
+{{ if or .Site.Params.OnlyBooks (in .Params.categories "book") }}
   {{ $fullTitle = printf "%s, %s" .Title $fullTitle }}
 {{ end }}
 {{ end }}
diff --git a/layouts/partials/root-toc.html b/layouts/partials/root-toc.html
index 2792ce9..834620b 100644
--- a/layouts/partials/root-toc.html
+++ b/layouts/partials/root-toc.html
@@ -1,8 +1,8 @@
+{{/* Do not use this, for now */}}
 	<details class="toc-collapse">
 		<summary>{{ i18n "toc" }}</summary>
-		{{ $currentLink := .RelPermalink }}
 		{{ range last 1 (where .Ancestors "Params.categories" "intersect" (slice "book") ) }}
 		<a href="{{ .RelPermalink }}">{{ .Title }}</a>
-		{{ partial "toc.html" (dict "content" . "currentLink" $currentLink) }}
+		{{ partial "toc.html" . }}
 		{{ end }}
 	</details>
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
index 3b5a822..607e7f0 100644
--- a/layouts/partials/toc.html
+++ b/layouts/partials/toc.html
@@ -1,5 +1,4 @@
-{{ $chapters := .content.Page.Pages }}
-{{ $currentLink := .currentLink}}
+{{ $chapters := .Page.Pages }}
 {{ range .Page.Translations }}
 {{ $chapters = $chapters | lang.Merge .Pages }}
 {{ end}}
@@ -10,14 +9,10 @@
     {{ with .Params.chapterName }}
       {{ $fullTitle = printf "%s – %s" $fullTitle . }}
     {{ end }}
-    {{ if eq $currentLink .RelPermalink }}
-      <a aria-current="page">{{ trim $fullTitle " " }}</a> ({{ i18n "current"}})
-    {{ else }}
-      <a href="{{ .RelPermalink }}">{{ trim $fullTitle " " }}</a>
-    {{ end }}
+    <a href="{{ .RelPermalink }}">{{ trim $fullTitle " " }}</a>
     {{ partial "post-info.html" . }}
     {{ if .IsSection}}
-      {{ partial "toc.html" (dict "content" . "currentLink" $currentLink) }}
+      {{ partial "toc.html" . }}
     {{ end }}
   </li>
   {{ end }}