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
This commit is contained in:
Allan Jude 2021-01-31 14:39:20 -05:00
parent 2809e50c1d
commit bc185da8de

View file

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