mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 22:14:08 +00:00
fix(docs): menu Z->A sort order
Fixes issue with using Docs layout for sections that need reverse menu sorting, such as updates (v5, v4.9, ..). Affected Docs site prior to conversion to Books layout.
This commit is contained in:
1 parent
514907d534
commit
182c09f49d
1 file changed
+6
-2
@@ -29,10 +29,13 @@
|
||||
{{ with (index site.Menus $menu_name) }}
|
||||
|
||||
{{/* Enable Updates layout to order by descending version name. */}}
|
||||
{{ $menu := (index site.Menus $menu_name).ByWeight }}
|
||||
{{ $menu := (index site.Menus $menu_name) }}
|
||||
{{ if eq ($.Scratch.Get "docs_menu_sort" | default "weight") "name_reverse" }}
|
||||
{{ $menu = (index site.Menus $menu_name).ByName.Reverse }}
|
||||
{{ $menu = sort $menu "Title" "desc" }}
|
||||
{{ else }}
|
||||
{{ $menu = $menu.ByWeight }}
|
||||
{{end}}
|
||||
|
||||
{{ range $menu }}
|
||||
<div class="docs-toc-item{{ if $current_page.IsMenuCurrent $menu_name . }} active{{ end }}">
|
||||
<a class="docs-toc-link" {{ if .URL }}href="{{ .URL }}"{{else if .HasChildren }}href="{{ (index .Children 0).URL }}"{{end}}>{{ .Name }}</a>
|
||||
@@ -43,6 +46,7 @@
|
||||
<li {{ if $current_page.IsMenuCurrent $menu_name . }}class="active"{{ end }}>
|
||||
<a href="{{ .URL }}">{{ .Name }}</a>
|
||||
</li>
|
||||
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
||||
Reference in new issue
Block a user