Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160838758
D44284.id136136.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D44284.id136136.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D44284: doc: Refactor for Hugo 0.123.X compatibility
Attached
Detach File
Event Timeline
Log In to Comment