Add header_above, header_below menu config

master
Will Faught 12 months ago
parent 5998a1f3b2
commit bf7811375e

@ -334,71 +334,37 @@ disable_title = false
disable = false # Exclude the page from search disable = false # Exclude the page from search
``` ```
The assigned values shown are the default values.
The parameter object is accessed in site parameters as `[params.paige]`, and in page parameters as `[paige]`. The parameter object is accessed in site parameters as `[params.paige]`, and in page parameters as `[paige]`.
The assigned values shown are the default values.
Parameters specific to pages: Parameters specific to pages:
```toml ```toml
link = "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title link = "" # The reference for an anchor around the title. Example: "https://youtu.be/dQw4w9WgXcQ".
```
The assigned values shown are the default values.
Parameters specific to menus:
```toml
[paige]
disabled = false
divider_above = false
divider_below = false
header_above = ""
header_below = ""
``` ```
The assigned values shown are the default values.
### Menu ### Menu
The menu can be configured using the `main` menu. The menu can be configured using the `main` menu.
The active menu item has a URL that is a prefix of the path of the current page. The active menu item has a URL that is a prefix of the path of the current page.
A menu item with the URL `/` only matches a `/` path. A menu item with the URL `/` only matches a `/` path.
Example configuration in `yoursite/hugo.toml`:
```toml
[languages.en]
weight = 10
[[languages.en.menu.main]]
identifier = "home"
name = "Home"
url = "/"
weight = 10
[[languages.en.menu.main]]
identifier = "blog"
name = "Blog"
url = "/blog/"
weight = 20
[[languages.en.menu.main]]
identifier = "personal"
name = "Personal"
parent = "blog"
url = "/blog/personal/"
weight = 10
[languages.en.menu.main.params.paige]
divider_below = true
[[languages.en.menu.main]]
identifier = "work"
name = "Work"
parent = "blog"
url = "/blog/work/"
weight = 20
[languages.en.menu.main.params.paige]
disabled = true
[[languages.en.menu.main]]
identifier = "interests"
name = "Interests"
parent = "blog"
url = "/blog/interests/"
weight = 30
[languages.en.menu.main.params.paige]
divider_above = true
```
If you intend for the menu to be sufficient for all navigation, If you intend for the menu to be sufficient for all navigation,
see [how to hide other navigation features](#menu-navigation-only). see [how to hide other navigation features](#menu-navigation-only).

@ -69,6 +69,12 @@
</li> </li>
{{ end }} {{ end }}
{{ with .Params.paige.header_above }}
<li>
<h6 class="dropdown-header">{{ . }}</h6>
</li>
{{ end }}
<li> <li>
<a class="{{ if .Params.paige.disabled }} disabled {{ end }} dropdown-item" href="{{ .URL | safeURL }}" {{ with partial "paige/target.html" (dict "page" $page "url" .URL) }} target="{{ . }}" {{ end }}>{{ .Name }}</a> <a class="{{ if .Params.paige.disabled }} disabled {{ end }} dropdown-item" href="{{ .URL | safeURL }}" {{ with partial "paige/target.html" (dict "page" $page "url" .URL) }} target="{{ . }}" {{ end }}>{{ .Name }}</a>
</li> </li>
@ -78,6 +84,12 @@
<hr class="dropdown-divider"> <hr class="dropdown-divider">
</li> </li>
{{ end }} {{ end }}
{{ with .Params.paige.header_below }}
<li>
<h6 class="dropdown-header">{{ . }}</h6>
</li>
{{ end }}
{{ end }} {{ end }}
</ul> </ul>
{{ end }} {{ end }}

Loading…
Cancel
Save