mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 19:15:16 +02: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:
parent
514907d534
commit
182c09f49d
1 changed files with 6 additions and 2 deletions
|
@ -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 }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue