git: bc185da8de - main - Improve the documentation front page with full book/article names

Allan Jude allanjude at FreeBSD.org
Mon Feb 1 01:09:51 UTC 2021


The branch main has been updated by allanjude:

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

commit bc185da8de5102c574e6dccbe3559591027a2d46
Author:     Allan Jude <allanjude at FreeBSD.org>
AuthorDate: 2021-01-31 19:39:20 +0000
Commit:     Allan Jude <allanjude at FreeBSD.org>
CommitDate: 2021-02-01 01:09:37 +0000

    Improve the documentation front page with full book/article names
    
    Use the title of the book or article rather than the directory name
    Also use the full name of the language, not just the short code
    
    Sponsored by:   Klara Inc.
    Reviewed by:    carlavilla
    Differential Revision:  https://reviews.freebsd.org/D28440
---
 documentation/themes/beastie/layouts/index.html | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/documentation/themes/beastie/layouts/index.html b/documentation/themes/beastie/layouts/index.html
index e7c72d5ee3..1ba57c710a 100644
--- a/documentation/themes/beastie/layouts/index.html
+++ b/documentation/themes/beastie/layouts/index.html
@@ -19,15 +19,13 @@
           </ul>
         </li>
       </ul>
-      <h1 class="books-title">{{ i18n "books" }} - {{ $home.Language }}</h1>
+      <h1 class="books-title">{{ i18n "books" }} - {{ $home.Language.LanguageName }}</h1>
       {{ $books := slice}}
 
       {{ range where .Site.Pages "Section" "books" }}
-        {{ with .File }}
-          {{ $subDirsNumer := .File.Path | strings.Count "/" }}
-          {{ if eq $subDirsNumer 2 }}
-            {{ $books  = $books  | append (dict "page" . "path" .File.Path) }}
-          {{ end }}
+        {{ $subDirsNumer := .File.Path | strings.Count "/" }}
+        {{ if eq $subDirsNumer 2 }}
+          {{ $books  = $books  | append (dict "page" . "path" .File.Path) }}
         {{ end }}
       {{ end }}
 
@@ -36,20 +34,18 @@
         {{ if in .path "_index.adoc" }}
           {{ $bookPath := replaceRE "/_index.adoc" "" .path }}
           {{ $bookName := replaceRE "books/" "" $bookPath }}
-          <li><a href="{{ $bookPath }}">{{ $bookName }}</a></li>
+          <li><a href="{{ $bookPath }}">{{ .page.Title }}</a></li>
         {{ end }}
       {{ end }}
       </ul>
 
-      <h1 class="articles-title">{{ i18n "articles" }} - {{ $home.Language }}</h1>
+      <h1 class="articles-title">{{ i18n "articles" }} - {{ $home.Language.LanguageName }}</h1>
       {{ $articles := slice}}
 
       {{ range where .Site.Pages "Section" "articles" }}
-        {{ with .File }}
-          {{ $subDirsNumer := .File.Path | strings.Count "/" }}
-          {{ if eq $subDirsNumer 2 }}
-            {{ $articles  = $articles  | append (dict "page" . "path" .File.Path) }}
-          {{ end }}
+        {{ $subDirsNumer := .File.Path | strings.Count "/" }}
+        {{ if eq $subDirsNumer 2 }}
+          {{ $articles  = $articles  | append (dict "page" . "path" .File.Path) }}
         {{ end }}
       {{ end }}
 
@@ -58,7 +54,7 @@
         {{ if in .path "_index.adoc" }}
           {{ $articlePath := replaceRE "/_index.adoc" "" .path }}
           {{ $articleName := replaceRE "articles/" "" $articlePath }}
-          <li><a href="{{ $articlePath }}">{{ $articleName }}</a></li>
+          <li><a href="{{ $articlePath }}">{{ .page.Title }}</a></li>
         {{ end }}
       {{ end }}
       </ul>


More information about the dev-commits-doc-all mailing list