mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +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
|
```toml
|
||||||
[params]
|
[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.
|
# 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.
|
# 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.
|
# See the config.toml file from this documentation site to have an example.
|
||||||
|
|
|
@ -21,13 +21,14 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<div class="highlightable">
|
<div class="highlightable">
|
||||||
<ul class="topics">
|
<ul class="topics">
|
||||||
|
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default false }}
|
||||||
{{- if eq .Site.Params.ordersectionsby "title" }}
|
{{- if eq .Site.Params.ordersectionsby "title" }}
|
||||||
{{- range .Site.Home.Sections.ByTitle }}
|
{{- 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 }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- range .Site.Home.Sections.ByWeight }}
|
{{- 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 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -113,13 +114,14 @@
|
||||||
{{- $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
|
{{- $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $pages := ($currentNode.Scratch.Get "pages") }}
|
{{- $pages := ($currentNode.Scratch.Get "pages") }}
|
||||||
|
{{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }}
|
||||||
{{- if eq .Site.Params.ordersectionsby "title" }}
|
{{- if eq .Site.Params.ordersectionsby "title" }}
|
||||||
{{- range $pages.ByTitle }}
|
{{- 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 }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{- range $pages.ByWeight }}
|
{{- 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 }}
|
||||||
{{- end }}</ul></li>
|
{{- end }}</ul></li>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|
Loading…
Reference in a new issue