Menu
Renders a menu for the given menu ID with support for nested items and active states.
Location : layouts/_partials/widgets/menu.html
Parameters :
| Parameter | Type | Description | Default |
|---|---|---|---|
menuID | string | The menu ID from config | required |
page | Page | Page context | required |
withParentId | string | Only render children of specified parent | - |
class | string | Additional CSS classes | - |
key | string | Config key for visibility | "Menu" |
Configuration :
yaml
params:
showMenu: true # Show/hide menu
menu:
main:
- name: "Home"
url: "/"
weight: 10
- name: "About"
url: "/about/"
weight: 20
- name: "Docs"
url: "/docs/"
weight: 30
parent: "Documentation" # For nested itemsExamples :
go
// Render main menu
{{ partial "widgets/menu.html" (dict "menuID" "main" "page" .) }}
// Render only children of "Documentation"
{{ partial "widgets/menu.html" (dict "menuID" "main" "page" . "withParentId" "Documentation") }}
// With custom class
{{ partial "widgets/menu.html" (dict
"menuID" "main"
"page" .
"class" "custom-menu"
) }}