Skip to content
Snippets Groups Projects
Commit a45e4f6b authored by Walter Lozano's avatar Walter Lozano Committed by Martyn Welch
Browse files

Sort sections by weight


The current theme sorts sections by the title, which makes it tricky to
highlight particular sections. To make it easier, switch to use the
weight property.

Signed-off-by: default avatarWalter Lozano <walter.lozano@collabora.com>
parent a5b2b48d
No related branches found
No related tags found
1 merge request!646Add overview section
......@@ -202,7 +202,8 @@
<nav class="sidebar sidebar-hidden" id="site-sidebar">
<ul>
{{- $section := .FirstSection -}}
{{- range sort .Site.Sections.ByTitle -}}
{{- range .Site.Sections.GroupBy "Weight" "asc"}}
{{- range sort .Pages.ByTitle}}
<li class="sidebar-section">
<a href="{{ .Permalink | relLangURL }}" {{ if eq .FirstSection $section }}id="sidebar-focus" class="sidebar-focus"{{end}}>{{ .Title }}</a>
<div class="sidebar-pages">
......@@ -212,6 +213,7 @@
</div>
</li>
{{- end -}}
{{- end -}}
</ul>
</nav>
......
<!-- see https://hugocodex.org/blog/creating-a-menu-with-nested-pages/-->
{{- $out := dict -}}
{{- range sort .Site.Sections.ByTitle -}}
{{- range .Site.Sections.GroupBy "Weight" "asc"}}
{{- range sort .Pages.ByTitle}}
{{- with .Site.GetPage (print "/" .Section "/_index.md") -}}
{{- $children := slice -}}
{{- range .RegularPages -}}
......@@ -14,4 +15,5 @@
{{- $out = merge $out (dict .Section $children) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- return $out -}}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment