diff --git a/exampleSite/content/basics/configuration/_index.en.md b/exampleSite/content/basics/configuration/_index.en.md
index 2365334102..d1c7e29eba 100644
--- a/exampleSite/content/basics/configuration/_index.en.md
+++ b/exampleSite/content/basics/configuration/_index.en.md
@@ -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.
diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html
index 7075bb1ced..63fe665792 100644
--- a/layouts/partials/menu.html
+++ b/layouts/partials/menu.html
@@ -21,13 +21,14 @@
{{- end }}
+ {{- $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 }}
@@ -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 }}
{{- else }}