Page MenuHomeFreeBSD

D44284.id136136.diff
No OneTemporary

D44284.id136136.diff

diff --git a/documentation/themes/beastie/layouts/partials/menu.html b/documentation/themes/beastie/layouts/partials/menu.html
--- a/documentation/themes/beastie/layouts/partials/menu.html
+++ b/documentation/themes/beastie/layouts/partials/menu.html
@@ -1,4 +1,12 @@
-{{ with .Site.GetPage .Params.path }}
+{{/* always extract the first part of the path to match it only with the main document/book. */}}
+{{ $path := "" }}
+{{ $regex := `^(\/[^\/]+\/[^\/]+)` }}
+{{ $matches := findRE $regex .Params.path }}
+{{ if gt (len $matches) 0 }}
+ {{ $path = index $matches 0 }}
+{{ end }}
+
+{{ with .Site.GetPage $path }}
<ul>
{{ range .Pages }}
<li>
diff --git a/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html b/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html
--- a/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html
+++ b/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html
@@ -1,14 +1,3 @@
-{{ $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 }}
- {{ end }}
-{{ end }}
-
{{ partial "global-search.html" . }}
<h1>{{ i18n "articles" }}</h1>
@@ -17,25 +6,12 @@
<hr class="line"/>
-{{ $articles := slice}}
-
-{{ range where .Site.Pages "Section" "articles" }}
- {{ $subDirsNumer := .File.Path | strings.Count "/" }}
- {{ if eq $subDirsNumer 2 }}
- {{ $articles = $articles | append (dict "page" . "path" .File.Path) }}
- {{ end }}
-{{ end }}
-
<ul class="documents-list">
-{{ range sort $articles "weight" "path" }}
- {{ if in .path "_index.adoc" }}
- {{ $articlePath := replaceRE "/_index.adoc" "" .path }}
- {{ $articlePath = replaceRE "articles/" "" $articlePath }}
- {{ $articleName := replaceRE "articles/" "" $articlePath }}
+{{ $articles := .Site.GetPage "section" "articles" }}
+{{ range $articles.Sections }}
<li>
- <a href="{{ $articlePath }}"><strong>{{ .page.Title }}</strong></a>
- <p>{{ .page.Params.description }}</p>
+ <a href="{{ .Permalink }}"><strong>{{ .Title }}</strong></a>
+ <p>{{ .Params.description }}</p>
</li>
- {{ end }}
{{ end }}
</ul>
diff --git a/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html b/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html
--- a/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html
+++ b/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html
@@ -1,14 +1,3 @@
-{{ $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 }}
- {{ end }}
-{{ end }}
-
{{ partial "global-search.html" . }}
<h1>{{ i18n "books" }}</h1>
@@ -17,25 +6,13 @@
<hr class="line"/>
-{{ $books := slice}}
-
-{{ range where .Site.Pages "Section" "books" }}
- {{ $subDirsNumer := .File.Path | strings.Count "/" }}
- {{ if eq $subDirsNumer 2 }}
- {{ $books = $books | append (dict "page" . "path" .File.Path) }}
- {{ end }}
-{{ end }}
-
<ul class="documents-list">
-{{ range sort $books "bookOrder" "path" }}
- {{ if in .path "_index.adoc" }}
- {{ $bookPath := replaceRE "/_index.adoc" "" .path }}
- {{ $bookPath = replaceRE "books/" "" $bookPath }}
- {{ $articleName := replaceRE "books/" "" $bookPath }}
+
+{{ $books := .Site.GetPage "section" "books" }}
+{{ range $books.Sections }}
<li>
- <a href="{{ $bookPath }}"><strong>{{ .page.Title }}</strong></a>
- <p>{{ .page.Params.description }}</p>
+ <a href="{{ .Permalink }}"><strong>{{ .Title }}</strong></a>
+ <p>{{ .Params.description }}</p>
</li>
- {{ end }}
{{ end }}
</ul>

File Metadata

Mime Type
text/plain
Expires
Mon, Jun 29, 11:42 AM (21 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34458545
Default Alt Text
D44284.id136136.diff (3 KB)

Event Timeline