随着页头模块 v0.16.0
版本的发布,你现在可以添加三级菜单。
为此,你需要将二级菜单的 identifier
作为三级菜单的 parent
。
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}