Just wondering if this is possible. My menu has 3 columns and I set the contents in config.yaml:
menu:
footercolumn1:
- identifier: blog
name: This is the blog section
title: blog section
url: /blog/
weight: 1
footercolumn2:
- identifier: blog5
name: This is the blog section
title: blog section
url: /blog/
weight: 1
- identifier: blog6
This works as expected. And each of the columns has a heading, so I was thinking if there was some way to extrapolate that information from the config file.
Something like this:
menu:
footercolumn1:
- name: About
- identifier: blog
name: This is the blog section
title: blog section
url: /blog/
weight: 1
Two options I could think of:
{{ range $k, $v := site.Menus }}
{{ humanize (string $k) }}
{{ end }}
Assuming you name your menus something humanize
-able, eg
menu:
footer-column-one:
...
=> Footer column one
Option 2 is to restructure your menus to have one main menu, and have parent-child relationships:
main:
- identifier: col1
name: Col 1 Heading
- identifier: col1a
name: Col 1 Child
parent: col1
1 Like
What do you mean by âextractingâ? Do you want to see what is set up? Then have a look at (you probably know it) hugo-debugprint. If you want to use these parameters somewhere else in the site than in a menu loop I would scratch
them once and use these variables.
I meant something like what @pointyfar suggested, where, once you know which menu you want to display, you donât need to specify the âhumanâ version of its title.