Skip to content

Commit de25c64

Browse files
committed
Sort pages and section by weight
1 parent ed5aa6b commit de25c64

File tree

1 file changed

+12
-13
lines changed
  • themes/opentermsarchive/layouts/partials

1 file changed

+12
-13
lines changed

themes/opentermsarchive/layouts/partials/aside.html

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,22 @@
1010
<details {{ if eq $currentPageSection .Section }}open{{ end }}>
1111
<summary><b>{{ .LinkTitle | markdownify }}</b></summary>
1212
<ul>
13-
{{ range .RegularPages.ByWeight }}
14-
<li>
15-
<a href="{{ .RelPermalink }}">{{ .LinkTitle | markdownify }}</a>
16-
</li>
17-
{{ end }}
18-
{{ range .Sections.ByWeight }}
13+
{{ $allPages := .RegularPages.ByWeight | append .Sections.ByWeight }}
14+
{{ $allPages := sort $allPages "Weight" }}
15+
{{ range $allPages }}
1916
<li>
2017
{{ if .Content }}
21-
<a href="{{ .RelPermalink }}">{{ .LinkTitle | markdownify }}</a>
18+
<a href="{{ .RelPermalink }}">{{ .LinkTitle | markdownify }}</a>
2219
{{ else }}
23-
<span>{{ .LinkTitle | markdownify }}</span>
20+
<span>{{ .LinkTitle | markdownify }}</span>
21+
{{ end }}
22+
{{ if .IsSection }}
23+
<ul>
24+
{{ range .RegularPages.ByWeight }}
25+
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle | markdownify }}</a></li>
26+
{{ end }}
27+
</ul>
2428
{{ end }}
25-
<ul>
26-
{{ range .RegularPages.ByWeight }}
27-
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle | markdownify }}</a></li>
28-
{{ end }}
29-
</ul>
3029
</li>
3130
{{ end }}
3231
</ul>

0 commit comments

Comments
 (0)