docs: fix oddities in sidebar menu configuration #1081

This commit is contained in:
Sören Weber 2025-03-30 23:32:23 +02:00
parent 865033d3ec
commit b932d301d7
No known key found for this signature in database
GPG Key ID: BEC6D55545451B6D
5 changed files with 29 additions and 8 deletions

View File

@ -227,26 +227,47 @@ If you don't set these options in your `hugo.toml`, the theme defaults as follow
- `sidebarheadermenus`:
- a divider to separate from the logo (depending on the color configuration of the theme variant) if any of the following is configured
- a home button if [configured](configuration/sidebar/headerfooter#home-button-configuration), if you redefine this, use a Hugo menu and a `type=menu` to replicate this
- a home button if [configured](configuration/sidebar/headerfooter#home-button-configuration), see notes below
- a divider
- the version switcher if versioning is [configured](configuration/sitemanagement/versioning)
- a divider to separate from the `sidebarmenus` (depending on the color configuration of the theme variant)
- `sidebarmenus`:
- the main page menu based on your [content structure](authoring/structure)
- the `shortcuts` menu including the title if [configured](#predefined-shortcuts-menu)
- the `shortcuts` menu including the title if [configured](#predefined-shortcuts-menu), see notes below
- `sidebarfootermenus`:
- a divider to separate from the `sidebarmenus` if any of the following is configured
- the language switcher if multilingual is [configured](configuration/sitemanagement/multilingual#turn-off-language-switching)
- the variant switcher if multiple variants are [configured](configuration/branding/colors/#multiple-variants)
- the history clearer if you [configured](configuration/sidebar/headerfooter#history) to mark visited pages
This comes down to the following pseudo default configuration.
{{< multiconfig section=params >}}
sidebarheadermenus = [
{ type = 'divider' },
{ type = 'menu', identifier = 'homelinks', disableTitle = true },
{ type = 'divider' },
{ type = 'custom', identifier = 'headercontrols', elements = [ { type = 'versionswitcher' } ] },
{ type = 'divider' }
]
sidebarmenus = [
{ type = 'page', identifier = 'main' },
{ type = 'menu', identifier = 'shortcuts', disableTitle = false }
]
sidebarfootermenus = [
{ type = 'divider' },
{ type = 'custom', elements = [ { type = 'historyclearer' }, { type = 'variantswitcher' }, { type = 'languageswitcher' } ] }
{ type = 'custom', identifier = 'footercontrols', elements = [ { type = 'historyclearer' }, { type = 'variantswitcher' }, { type = 'languageswitcher' } ] }
]
{{< /multiconfig >}}
and no multilingual configuration is configured, the language switcher will be shown non the less.
Notes:
- multiple consecutive dividers are removed by the theme if no other content is in between them
- if you redefine the `homelinks` like displayed above, you have to define a Hugo menu to replicate the implicit default configuration
- for the `shortcuts` if the implicit default configuration is active, the value for `disableTitle` will be determined by your [configuration for `disableShortcutsTitle`](#predefined-shortcuts-menu).
### Page Menu

View File

@ -1,7 +1,7 @@
{{- $defaultmenuconfigs := slice }}
{{- $defaultmenuconfigs = $defaultmenuconfigs | append
(dict "type" "page" "identifier" "home")
(dict "type" "page" "identifier" "main")
}}
{{- $defaultmenuconfigs = $defaultmenuconfigs | append

View File

@ -7,7 +7,7 @@
{{- $defaultconfigelements = $defaultconfigelements | append (dict "type" "variantswitcher") }}
{{- $defaultconfigelements = $defaultconfigelements | append (dict "type" "historyclearer") }}
{{- $defaultmenuconfigs = $defaultmenuconfigs | append
(dict "type" "custom" "identifier" "controls" "disableTitle" true "elements" $defaultconfigelements)
(dict "type" "custom" "identifier" "footercontrols" "elements" $defaultconfigelements)
}}
{{- return $defaultmenuconfigs }}

View File

@ -33,7 +33,7 @@
{{- $defaultconfigelements = $defaultconfigelements | append (dict "type" "versionswitcher") }}
{{- $defaultmenuconfigs = $defaultmenuconfigs | append
(dict "type" "custom" "identifier" "controls" "disableTitle" true "elements" $defaultconfigelements)
(dict "type" "custom" "identifier" "headercontrols" "elements" $defaultconfigelements)
}}
{{- $defaultmenuconfigs = $defaultmenuconfigs | append (dict "type" "divider") }}

View File

@ -1 +1 @@
7.6.0+4e48cbf22278352557c206b228e98fc9de9d9f88
7.6.0+865033d3ec34d9303225defd6b595da98aab4f92