Skip to content

Commit

Permalink
Feature request: Add theme setting for default sorting of menu entries
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeantet committed Jul 19, 2017
1 parent 575f2cd commit be1e675
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ noSearch = false # default is false
showVisitedLinks = true # default is false
# themeStyle = "theme" # overide base css
themeVariant = "" # choose theme variant "green", "gold" , "gray", "blue" (default)

ordersectionsby = "weight" # ordersectionsby = "title"

[outputs]
home = [ "HTML", "RSS", "JSON"]
Expand Down
10 changes: 10 additions & 0 deletions layouts/partials/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,22 @@
{{ .Scratch.Set "pages" (.Pages | union .Sections) }}
{{end}}
{{ $pages := (.Scratch.Get "pages") }}

{{if eq .Site.Params.ordersectionsby "title"}}
{{ range $pages.ByTitle }}
{{ if and .Params.hidden (not $.showhidden) }}
{{else}}
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }}
{{end}}
{{ end }}
{{else}}
{{ range $pages.ByWeight }}
{{ if and .Params.hidden (not $.showhidden) }}
{{else}}
{{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }}
{{end}}
{{ end }}
{{end}}
</ul>
{{ end }}
</li>
Expand Down

0 comments on commit be1e675

Please sign in to comment.