Skip to content

Commit fba06f2

Browse files
authored
fix: allow using negative number as navWeight (#1131)
fix: sorting docs navigation items in LinkTitle rather than Title Closes #1130
1 parent da5ad56 commit fba06f2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

layouts/partials/docs/doc-nav.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
{{- with .CurrentSection }}
33
{{- $pages = .Pages }}
44
{{- end }}
5-
{{- $sortedPages := sort (where $pages "Params.navWeight" ">" 0) "Params.navWeight" "desc" -}}
6-
{{- $pages = union $sortedPages (sort $pages "Title") -}}
5+
{{- $sortedPages := sort (where $pages "Params.navWeight" "ne" nil) "Params.navWeight" "desc" -}}
6+
{{- $pages = union $sortedPages (sort $pages "LinkTitle") -}}
77
{{- $prev := false }}
88
{{- $next := false }}
99
{{- range $i, $page := $pages }}

layouts/partials/docs/nav.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
{{- $page := .page -}}
1818
<ul class="list-unstyled mb-2 w-100">
1919
{{- $expand := default false .page.Site.Params.docs.nav.expand -}}
20-
{{- $pages := sort (where $section.Pages "Params.navWeight" ">" 0) "Params.navWeight" "desc" -}}
21-
{{- $pages = union $pages (sort $section.Pages "Title") -}}
20+
{{- $pages := sort (where $section.Pages "Params.navWeight" "ne" nil) "Params.navWeight" "desc" -}}
21+
{{- $pages = union $pages (sort $section.Pages "LinkTitle") -}}
2222
{{- range $pages -}}
2323
{{- if .IsSection -}}
2424
{{- $sectionId := printf "nav-%s" .File.UniqueID -}}

0 commit comments

Comments
 (0)