Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Printing child links using the menu function
Member | Platinum Partner
Aug 25, 2020 5:19 AM
I have a menu in the HubSpot backend configured like this:
I'm trying to use the menu function to print out the markup of the above menu.
At the moment, I have:
{% set menu = menu(module.menu) %}
{% for item in menu.children %}
<li class="{{ item.label|lower|replace(' ', '-') }}">
<a href="{{ item.url }}">{{ item.label }}</a>
</li>
{% endfor %}
But the above only prints the markup for top level links, not the child links underneath them. So it prints the following markup:
<li class="get-connected">
<a href="#">Get connected</a>
</li>
<li class="register">
<a href="#">Register</a>
</li>
<li class="tracks">
<a href="#">Tracks</a>
</li>
How can I get it so that it prints the child markup too? So, what I am looking for is this (example):
<li class="get-connected">
<a href="#">Get connected</a>
<ul>
<li>FF Studio</li>
<li>FF Blog</li>
</ul>
</li>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content