mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
menu: add default setting for menu expansion #97
This commit is contained in:
parent
a96e6b93f8
commit
3d0554124a
2 changed files with 10 additions and 4 deletions
|
@ -11,6 +11,10 @@ Note that some of these parameters are explained in details in other sections of
|
|||
|
||||
```toml
|
||||
[params]
|
||||
# This controls whether submenus will be expanded (true), or collapsed (false) in the
|
||||
# menu; if no setting is given, the first menu level is set to false, all others to true;
|
||||
# this can be overridden in the pages frontmatter
|
||||
alwaysopen = true
|
||||
# Prefix URL to edit current page. Will display an "Edit this page" button on top right hand corner of every page.
|
||||
# Useful to give opportunity to people to create merge request for your doc.
|
||||
# See the config.toml file from this documentation site to have an example.
|
||||
|
|
|
@ -21,13 +21,14 @@
|
|||
{{- end }}
|
||||
<div class="highlightable">
|
||||
<ul class="topics">
|
||||
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }}
|
||||
{{- if eq .Site.Params.ordersectionsby "title" }}
|
||||
{{- range .Site.Home.Sections.ByTitle }}
|
||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" false }}
|
||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- range .Site.Home.Sections.ByWeight }}
|
||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" false }}
|
||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</ul>
|
||||
|
@ -113,13 +114,14 @@
|
|||
{{- $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
|
||||
{{- end }}
|
||||
{{- $pages := ($currentNode.Scratch.Get "pages") }}
|
||||
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }}
|
||||
{{- if eq .Site.Params.ordersectionsby "title" }}
|
||||
{{- range $pages.ByTitle }}
|
||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- range $pages.ByWeight }}
|
||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" true}}
|
||||
{{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks "alwaysopen" $defaultAlwaysopen }}
|
||||
{{- end }}
|
||||
{{- end }}</ul></li>
|
||||
{{- else }}
|
||||
|
|
Loading…
Reference in a new issue