git: e8a6a98110 - main - Add home button to the navigation of the books

From: Sergio Carlavilla Delgado <carlavilla_at_FreeBSD.org>
Date: Fri, 31 Dec 2021 12:27:00 UTC
The branch main has been updated by carlavilla:

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

commit e8a6a98110ea377c2717da8d185f44bc30085a7d
Author:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
AuthorDate: 2021-12-31 12:25:39 +0000
Commit:     Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
CommitDate: 2021-12-31 12:25:39 +0000

    Add home button to the navigation of the books
    
    PR:             260705
    Submitted by:   Graham Perrin <grahamperrin (AT) gmail.com>
---
 .../beastie/assets/styles/documentation.scss       | 11 +++++--
 documentation/themes/beastie/i18n/bn-bd.toml       |  3 ++
 documentation/themes/beastie/i18n/da.toml          |  3 ++
 documentation/themes/beastie/i18n/de.toml          |  3 ++
 documentation/themes/beastie/i18n/el.toml          |  3 ++
 documentation/themes/beastie/i18n/en.toml          |  3 ++
 documentation/themes/beastie/i18n/es.toml          |  3 ++
 documentation/themes/beastie/i18n/fr.toml          |  3 ++
 documentation/themes/beastie/i18n/hu.toml          |  3 ++
 documentation/themes/beastie/i18n/it.toml          |  3 ++
 documentation/themes/beastie/i18n/ja.toml          |  3 ++
 documentation/themes/beastie/i18n/ko.toml          |  3 ++
 documentation/themes/beastie/i18n/mn.toml          |  3 ++
 documentation/themes/beastie/i18n/nl.toml          |  3 ++
 documentation/themes/beastie/i18n/pl.toml          |  3 ++
 documentation/themes/beastie/i18n/pt-br.toml       |  3 ++
 documentation/themes/beastie/i18n/ru.toml          |  3 ++
 documentation/themes/beastie/i18n/tr.toml          |  3 ++
 documentation/themes/beastie/i18n/zh-cn.toml       |  3 ++
 documentation/themes/beastie/i18n/zh-tw.toml       |  3 ++
 .../themes/beastie/layouts/books/list.html         | 35 ++++++++++++++++++++++
 .../themes/beastie/layouts/books/single.html       | 35 ++++++++++++++++++++++
 22 files changed, 136 insertions(+), 2 deletions(-)

diff --git a/documentation/themes/beastie/assets/styles/documentation.scss b/documentation/themes/beastie/assets/styles/documentation.scss
index b537252b4f..cdbfbda0ec 100644
--- a/documentation/themes/beastie/assets/styles/documentation.scss
+++ b/documentation/themes/beastie/assets/styles/documentation.scss
@@ -174,7 +174,7 @@
     .buttons {
       display: flex;
 
-      .prev, .next {
+      .prev, .home, .next {
         display: flex;
         flex-direction: row;
         align-items: center;
@@ -184,7 +184,14 @@
         }
       }
 
-      .next {
+      .home {
+        i {
+          padding-left: .2rem;
+          padding-right: .2rem;
+        }
+      }
+
+      .home, .next {
         margin-left: auto;
       }
 
diff --git a/documentation/themes/beastie/i18n/bn-bd.toml b/documentation/themes/beastie/i18n/bn-bd.toml
index 22af497b12..64c466ad01 100644
--- a/documentation/themes/beastie/i18n/bn-bd.toml
+++ b/documentation/themes/beastie/i18n/bn-bd.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/da.toml b/documentation/themes/beastie/i18n/da.toml
index 22af497b12..64c466ad01 100644
--- a/documentation/themes/beastie/i18n/da.toml
+++ b/documentation/themes/beastie/i18n/da.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/de.toml b/documentation/themes/beastie/i18n/de.toml
index fc4c819c0d..306d80f41e 100644
--- a/documentation/themes/beastie/i18n/de.toml
+++ b/documentation/themes/beastie/i18n/de.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/el.toml b/documentation/themes/beastie/i18n/el.toml
index df05db7c21..883938bc35 100644
--- a/documentation/themes/beastie/i18n/el.toml
+++ b/documentation/themes/beastie/i18n/el.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/en.toml b/documentation/themes/beastie/i18n/en.toml
index 22af497b12..64c466ad01 100644
--- a/documentation/themes/beastie/i18n/en.toml
+++ b/documentation/themes/beastie/i18n/en.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/es.toml b/documentation/themes/beastie/i18n/es.toml
index b494af2597..52bb715161 100644
--- a/documentation/themes/beastie/i18n/es.toml
+++ b/documentation/themes/beastie/i18n/es.toml
@@ -157,6 +157,9 @@ other = "Anterior"
 [next]
 other = "Siguiente"
 
+[home]
+other = "Inicio"
+
 [split-html]
 other = "HTML dividido"
 
diff --git a/documentation/themes/beastie/i18n/fr.toml b/documentation/themes/beastie/i18n/fr.toml
index b447a416ec..944e93fbb2 100644
--- a/documentation/themes/beastie/i18n/fr.toml
+++ b/documentation/themes/beastie/i18n/fr.toml
@@ -158,6 +158,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/hu.toml b/documentation/themes/beastie/i18n/hu.toml
index a2a56d3b93..4a647f5ff3 100644
--- a/documentation/themes/beastie/i18n/hu.toml
+++ b/documentation/themes/beastie/i18n/hu.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/it.toml b/documentation/themes/beastie/i18n/it.toml
index f1e4fbdd79..ed6d409c5d 100644
--- a/documentation/themes/beastie/i18n/it.toml
+++ b/documentation/themes/beastie/i18n/it.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/ja.toml b/documentation/themes/beastie/i18n/ja.toml
index d765c9c33b..1cea373aed 100644
--- a/documentation/themes/beastie/i18n/ja.toml
+++ b/documentation/themes/beastie/i18n/ja.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/ko.toml b/documentation/themes/beastie/i18n/ko.toml
index 22af497b12..64c466ad01 100644
--- a/documentation/themes/beastie/i18n/ko.toml
+++ b/documentation/themes/beastie/i18n/ko.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/mn.toml b/documentation/themes/beastie/i18n/mn.toml
index ab5712c6fd..587bc0761c 100644
--- a/documentation/themes/beastie/i18n/mn.toml
+++ b/documentation/themes/beastie/i18n/mn.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/nl.toml b/documentation/themes/beastie/i18n/nl.toml
index aa0c1b9d76..42d0970c40 100644
--- a/documentation/themes/beastie/i18n/nl.toml
+++ b/documentation/themes/beastie/i18n/nl.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/pl.toml b/documentation/themes/beastie/i18n/pl.toml
index 22af497b12..64c466ad01 100644
--- a/documentation/themes/beastie/i18n/pl.toml
+++ b/documentation/themes/beastie/i18n/pl.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/pt-br.toml b/documentation/themes/beastie/i18n/pt-br.toml
index 22af497b12..64c466ad01 100644
--- a/documentation/themes/beastie/i18n/pt-br.toml
+++ b/documentation/themes/beastie/i18n/pt-br.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/ru.toml b/documentation/themes/beastie/i18n/ru.toml
index 4b04d5f50a..66d9f429e0 100644
--- a/documentation/themes/beastie/i18n/ru.toml
+++ b/documentation/themes/beastie/i18n/ru.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/tr.toml b/documentation/themes/beastie/i18n/tr.toml
index 22af497b12..64c466ad01 100644
--- a/documentation/themes/beastie/i18n/tr.toml
+++ b/documentation/themes/beastie/i18n/tr.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/zh-cn.toml b/documentation/themes/beastie/i18n/zh-cn.toml
index 0e97b8fff3..6a351ee1ca 100644
--- a/documentation/themes/beastie/i18n/zh-cn.toml
+++ b/documentation/themes/beastie/i18n/zh-cn.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/i18n/zh-tw.toml b/documentation/themes/beastie/i18n/zh-tw.toml
index 3775ea5ec5..48ca2c2440 100644
--- a/documentation/themes/beastie/i18n/zh-tw.toml
+++ b/documentation/themes/beastie/i18n/zh-tw.toml
@@ -157,6 +157,9 @@ other = "Prev"
 [next]
 other = "Next"
 
+[home]
+other = "Home"
+
 [split-html]
 other = "Split HTML"
 
diff --git a/documentation/themes/beastie/layouts/books/list.html b/documentation/themes/beastie/layouts/books/list.html
index d612387092..7b0998acce 100644
--- a/documentation/themes/beastie/layouts/books/list.html
+++ b/documentation/themes/beastie/layouts/books/list.html
@@ -60,14 +60,49 @@
       <div class="prev">
         <i class="fa fa-angle-left" aria-hidden="true"></i>
         <div class="container">
+          {{ if $.Site.Params.isOnline }}
           <a href={{ .Params.Prev | absLangURL }} class="direction">{{ i18n "prev" }}</a>
+          {{ else }}
+            {{ $pathSectionsPrev := split .Params.Prev "/" }}
+
+            {{if eq (len $pathSectionsPrev) 3}}
+              {{ $path := index $pathSectionsPrev 2 }}
+              <a href=../{{ $path }}/index.html>{{ i18n "prev" }}</a>
+            {{ end }}
+            {{if eq (len $pathSectionsPrev) 2}}
+              <a href=../index.html>{{ i18n "prev" }}</a>
+            {{ end }}
+          {{ end }}
         </div>
       </div>
       {{ end }}
+      <div class="home">
+        <i class="fa fa-home" aria-hidden="true"></i>
+        <div class="container">
+          <a href="../" class="direction">{{ i18n "home" }}</a>
+        </div>
+      </div>
       {{ if .Params.next }}
       <div class="next">
         <div class="container">
+          {{ if $.Site.Params.isOnline }}
           <a href={{ .Params.Next | absLangURL }}  class="direction">{{ i18n "next" }}</a>
+          {{ else }}
+            {{ $pathSectionsNext := split .Params.Next "/" }}
+            {{if eq (len $pathSectionsNext) 3}}
+              {{ if .Params.isIndex }}
+                {{ $book := index $pathSectionsNext 1 }}
+                {{ $path := index $pathSectionsNext 2 }}
+                <a href=../{{ $book }}/{{ $path }}/index.html>{{ i18n "next" }}</a>
+              {{ else }}
+                {{ $path := index $pathSectionsNext 2 }}
+                <a href=../{{ $path }}/index.html>{{ i18n "next" }}</a>
+              {{ end }}
+            {{ end }}
+            {{if eq (len $pathSectionsNext) 2}}
+              <a href=../index.html>{{ i18n "next" }}</a>
+            {{ end }}
+          {{ end }}
         </div>
         <i class="fa fa-angle-right" aria-hidden="true"></i>
       </div>
diff --git a/documentation/themes/beastie/layouts/books/single.html b/documentation/themes/beastie/layouts/books/single.html
index d612387092..7b0998acce 100644
--- a/documentation/themes/beastie/layouts/books/single.html
+++ b/documentation/themes/beastie/layouts/books/single.html
@@ -60,14 +60,49 @@
       <div class="prev">
         <i class="fa fa-angle-left" aria-hidden="true"></i>
         <div class="container">
+          {{ if $.Site.Params.isOnline }}
           <a href={{ .Params.Prev | absLangURL }} class="direction">{{ i18n "prev" }}</a>
+          {{ else }}
+            {{ $pathSectionsPrev := split .Params.Prev "/" }}
+
+            {{if eq (len $pathSectionsPrev) 3}}
+              {{ $path := index $pathSectionsPrev 2 }}
+              <a href=../{{ $path }}/index.html>{{ i18n "prev" }}</a>
+            {{ end }}
+            {{if eq (len $pathSectionsPrev) 2}}
+              <a href=../index.html>{{ i18n "prev" }}</a>
+            {{ end }}
+          {{ end }}
         </div>
       </div>
       {{ end }}
+      <div class="home">
+        <i class="fa fa-home" aria-hidden="true"></i>
+        <div class="container">
+          <a href="../" class="direction">{{ i18n "home" }}</a>
+        </div>
+      </div>
       {{ if .Params.next }}
       <div class="next">
         <div class="container">
+          {{ if $.Site.Params.isOnline }}
           <a href={{ .Params.Next | absLangURL }}  class="direction">{{ i18n "next" }}</a>
+          {{ else }}
+            {{ $pathSectionsNext := split .Params.Next "/" }}
+            {{if eq (len $pathSectionsNext) 3}}
+              {{ if .Params.isIndex }}
+                {{ $book := index $pathSectionsNext 1 }}
+                {{ $path := index $pathSectionsNext 2 }}
+                <a href=../{{ $book }}/{{ $path }}/index.html>{{ i18n "next" }}</a>
+              {{ else }}
+                {{ $path := index $pathSectionsNext 2 }}
+                <a href=../{{ $path }}/index.html>{{ i18n "next" }}</a>
+              {{ end }}
+            {{ end }}
+            {{if eq (len $pathSectionsNext) 2}}
+              <a href=../index.html>{{ i18n "next" }}</a>
+            {{ end }}
+          {{ end }}
         </div>
         <i class="fa fa-angle-right" aria-hidden="true"></i>
       </div>