Header now supports third-level menus

Donate

Become a backer or sponsor to support our work.

Sponsors

With header module v0.16.0, now you’re able to add third-level menus.

To do so, you’ll need to use the 2rd-level menu’s identifier as the parent for 3rd-level menus.

hugo.toml

 1[menu]
 2  [[menu.main]]
 3    identifier = 'lvl-1'
 4    name = 'Level 1'
 5  [[menu.main]]
 6    identifier = 'lvl-1-2'
 7    name = 'Level 1-2'
 8    parent = 'lvl-1'
 9    [menu.main.params]
10      description = '2nd level menus.'
11  [[menu.main]]
12    name = 'Level 1-2-1'
13    parent = 'lvl-1-2'
14  [[menu.main]]
15    name = 'Level 1-2-2'
16    parent = 'lvl-1-2'
17  [[menu.main]]
18    name = 'Level 1-2-3'
19    parent = 'lvl-1-2'

hugo.yaml

 1menu:
 2  main:
 3  - identifier: lvl-1
 4    name: Level 1
 5  - identifier: lvl-1-2
 6    name: Level 1-2
 7    params:
 8      description: 2nd level menus.
 9    parent: lvl-1
10  - name: Level 1-2-1
11    parent: lvl-1-2
12  - name: Level 1-2-2
13    parent: lvl-1-2
14  - name: Level 1-2-3
15    parent: lvl-1-2

hugo.json

 1{
 2   "menu": {
 3      "main": [
 4         {
 5            "identifier": "lvl-1",
 6            "name": "Level 1"
 7         },
 8         {
 9            "identifier": "lvl-1-2",
10            "name": "Level 1-2",
11            "params": {
12               "description": "2nd level menus."
13            },
14            "parent": "lvl-1"
15         },
16         {
17            "name": "Level 1-2-1",
18            "parent": "lvl-1-2"
19         },
20         {
21            "name": "Level 1-2-2",
22            "parent": "lvl-1-2"
23         },
24         {
25            "name": "Level 1-2-3",
26            "parent": "lvl-1-2"
27         }
28      ]
29   }
30}

Header third-level menus example

razonyang
Sunday, December 22, 2024 Tuesday, October 8, 2024