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

Allan Jude <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
The branch main has been updated by allanjude:

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

commit bc185da8de5102c574e6dccbe3559591027a2d46
Author:     Allan Jude <[email protected]>
AuthorDate: 2021-01-31 19:39:20 +0000
Commit:     Allan Jude <[email protected]>
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>
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.