MODULES
Siteglide Modules

Menu Builder

8min
create a nested menu structure using the pages you've built and customise its layout menu builder automatically displays existing pages on the left hand side for you to add to the menu, which is on the right hand side to add menu items that link to webapp items, or to external links; add an existing page and click on the link icon to edit the fields you can fully customise all fields from here syntax {% include 'menu' id '6560' layout 'default' name 'main navigation' %} parameters id the menu's id layout default is /default/ 'layout' values are relative to the folder layouts/modules/menu (module 2)/\[layout name] name name of the menu liquid tags field name liquid tag description current level menu items {% include 'modules/siteglide menu/get/get items', item layout 'item' %} outputs all top level menu items with li should be used in wrapper liquid current level name {{ this\['link name'] }} outputs menu item name should be used in item liquid current level url {{ this\['link url'] }} url of the item current level custom class {{this\['link class']}} class field contents for current item sub levels menu items {% assign next level = level | plus 1 %} {% include 'modules/siteglide menu/get/get items', level next level, parent id this\['forced id'], item layout 'item' %} outputs all sub level menu items with the current layout applied should be used in item liquid this essentially creates a loop until it reaches the bottom level of your menu mark as parent {{ this\['is parent'] }} an invisible field used to define if an item has sub items or not if item has sub items it's value will be true if an item does not have sub items it's value will be false layout files menu builder module layouts are stored in the following folder structure, which you can view via code editor layouts/modules/menu (module 2)/ within this module folder you will find the following layout folders default/ the layout folder item liquid menu item file wrapper liquid menu item wrapper file example wrapper liquid the wrapper file is used to wrap the menu item output and should contain the liquid for outputting the menu items you can wrap your menu with any content you'd like, such as a plain \<ul> tag, or a section wrapper with a title &#x9;{% include 'modules/siteglide menu/get/get items' &#x9; item layout 'item' &#x9; %} example item liquid the item file is the chosen output for our items in this example we've got two cases being used {% if this\['is parent'] %} {{this\['link name']}} {% comment %} wrap children in ul, set the next level, and then get the children {% endcomment %} {% assign next level = level | plus 1 %} {% include 'modules/siteglide menu/get/get items' level next level parent id this\['forced id'] item layout 'item' %} {% comment %} else just output the item by itself {% endcomment %} {% else %}&#x9; {{this\['link name']}} {% endif %} 1\ the item is a parent, so has sub items this means we output the item, and then increment the 'level' value in order to output this item's sub items in this case, we use the same item output for every level you may want a different file for each level to do that, on line 8 you should set the item layout as 'level2' for example then you should create a new copy of this 'item' file called 'level2' and put your new layout for the second level there alternatively, you can target each level in an {% if %} statement, but we suggest using new files to separate the layouts more easily since we use this same layout for every level, it loops until the bottom level, where the item is no longer a parent 2\ the item has no sub items this means we simply output the item, and nothing else