/themes/default/partials/
.
Path
for the default menus will hide the menu as there will be a mismatch between the Path and the reference in the template.Path
and the code reference in the menu template. Let’s see how the main menu template looks like (the file is /themes/default/partials/
directory and is called top_nav.tmpl
) for the part that we are interested in:
{{ if GetMenus.Primary }}
: This statement calls the “GetMenus” function and checks if there is a menu called Primary
. If present, it goes into the next line:{{ range GetMenus.Primary.Children }}
Each Menu (Primary) has some children (Menu items) so what this code does is loop through all the children and they are rendered as below:{{ .Path }}
is the Path we have defined from the UI and{{ .Tag }}
is the Name we have defined from the UI.{{ if .Children }}
: This line checks if the menu item has any submenus. If it does it loops through those children {{ range .Children }}
and finally renders them <a class="dropdown-item" href="{{.Path}}">{{.Tag}}</a>
similarly as the main menu items.
So now the child of Catalogs which we named Product 1 has been rendered.