The default way to add a menu to a template::
{{ menu(identifier = 'footer',
template = 'partials/_sub_menu.twig',
params = {'withsubmenus': false, 'class': 'inline-list align-right'}**strong text**
) }}
But how to build a secondary menu from other files than menu.yml
?
To add a secondary menu go to menu.yml
add for the mentioned example this lines of code:
footer:
- label: Imprint
title: Go to Imprint
path: page/imprint
class: first
The documentation can be found here: https://docs.bolt.cm/3.0/content/menus
Further explanation:
All menus used have to be declared in menu.yml
.
To render them correctly you can call them in two different ways.
Example #1:
{{ menu(identifier = 'footer', template = 'partials/_sub_menu.twig') }}
Example #2 (Short hand syntax):
{{ menu(footer', 'partials/_sub_menu.twig') }}
Note: You can define more than one menu in your menu.yml file, but you should define only one menu in each template file. So, if you have multiple menus that should be rendered with different HTML, you should have as many _menu_menuname.twig files in your theme.