hello how to add a site wide menu block to @layout.latte

dangquan091
Member | 1
+
0
-

I have created a folder under templates called sitemenu.

In that folder I have a file called sitemenu.latte with the following code

{block mainmenu}
main Menu code here
{/block}

{block usermenu}
user Menu code here
{/block}
How do I include sitemenu.latte in @layout.latte and conditionally use the different menu blocks?

duke
Member | 650
+
0
-

Try:

{import "sitemenu.latte"}

… and then:

{include mainmenu}

If the blocks are meant to be included this way only, maybe they should be defined via define macro:

{define mainmenu}
main menu code here
{/define}

… rather than via block macro.