git: 1f24364480 - main - documentation/themes: Enhance the book-menu feature

From: Danilo G. Baio <dbaio_at_FreeBSD.org>
Date: Sun, 15 Sep 2024 13:05:46 UTC
The branch main has been updated by dbaio:

URL: https://cgit.FreeBSD.org/doc/commit/?id=1f2436448047d6251ff9215c58e6af54bded5594

commit 1f2436448047d6251ff9215c58e6af54bded5594
Author:     Danilo G. Baio <dbaio@FreeBSD.org>
AuthorDate: 2024-09-15 12:49:01 +0000
Commit:     Danilo G. Baio <dbaio@FreeBSD.org>
CommitDate: 2024-09-15 12:49:01 +0000

    documentation/themes: Enhance the book-menu feature
    
    To activate the book menu, it is essential for the document to have a
    showBookMenu parameter set as a boolean. However, not all documents use
    a boolean; many utilize a string 'true' instead. This inconsistency
    often arises from translations, where our current tool, po4a, does not
    handle frontmatter correctly. This will ensure that the book menu
    displays correctly regardless of whether showBookMenu is set as a
    boolean or a string.
---
 documentation/themes/beastie/layouts/books/list.html   | 4 ++--
 documentation/themes/beastie/layouts/books/single.html | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/documentation/themes/beastie/layouts/books/list.html b/documentation/themes/beastie/layouts/books/list.html
index 08672d3097..ccc0152d0b 100644
--- a/documentation/themes/beastie/layouts/books/list.html
+++ b/documentation/themes/beastie/layouts/books/list.html
@@ -2,7 +2,7 @@
 <input type="checkbox" class="hidden toggle" id="menu-control">
 <main class="main-wrapper-book">
   <a id="top"></a>
-  {{ if eq .Params.showBookMenu true }}
+  {{ if or (eq (string .Params.showBookMenu) "true") (eq .Params.showBookMenu true) }}
   <aside class="book-menu">
     <div class="book-menu-content">
       <input id="search-book" type="text" placeholder="{{ i18n "search" }}" aria-label="{{ i18n "search" }}" maxlength="128" />
@@ -13,7 +13,7 @@
   </aside>
   {{ end }}
   <div class="book">
-    {{ if eq .Params.showBookMenu true }}
+    {{ if or (eq (string .Params.showBookMenu) "true") (eq .Params.showBookMenu true) }}
     <div class="book-menu-mobile">
       <label for="menu-control">
         <span class="menu-control-button">
diff --git a/documentation/themes/beastie/layouts/books/single.html b/documentation/themes/beastie/layouts/books/single.html
index 08672d3097..ccc0152d0b 100644
--- a/documentation/themes/beastie/layouts/books/single.html
+++ b/documentation/themes/beastie/layouts/books/single.html
@@ -2,7 +2,7 @@
 <input type="checkbox" class="hidden toggle" id="menu-control">
 <main class="main-wrapper-book">
   <a id="top"></a>
-  {{ if eq .Params.showBookMenu true }}
+  {{ if or (eq (string .Params.showBookMenu) "true") (eq .Params.showBookMenu true) }}
   <aside class="book-menu">
     <div class="book-menu-content">
       <input id="search-book" type="text" placeholder="{{ i18n "search" }}" aria-label="{{ i18n "search" }}" maxlength="128" />
@@ -13,7 +13,7 @@
   </aside>
   {{ end }}
   <div class="book">
-    {{ if eq .Params.showBookMenu true }}
+    {{ if or (eq (string .Params.showBookMenu) "true") (eq .Params.showBookMenu true) }}
     <div class="book-menu-mobile">
       <label for="menu-control">
         <span class="menu-control-button">