HubL for custom menu?

Hi all,

I have created a static version of my header, main navigation and footer. I have implemented those into my template and all looks good. I now want to make the menu more dynamic so the client can update labels and URLs for those - is there a way using HubL to add dynamic menu values within my header and footer markup?

Thanks!

Colin

Absolutely, go to:

Settings (gear icon top right) → Marketing → Web Pages → Advanced menus

They can build out the menu there.

And, in your template, replace your menu with the HUBL markup for menus

{% menu "my_menu" id=456, site_map_name='Default', overrideable=False, root_type='site_root', flyouts='true', max_levels='2', flow='horizontal', label='Advanced Menu' %}


tim@belch.io

Thanks I will try this!

@tjoycedo you know if it’s possible to take some HubL conditions and just get the individual labels and urls from each? I don’t want all the generated markup as I’ve already have a working menu and would rather not have to rework my CSS to fit this. Something like (psuedo):

{% if menu == "the menu I want label" %}
{% for item in menu %}
 <li><a href="{{ item.url }}">{{item.text}}</a></li>
 {% endfor %}

@evanshunt - Unfortunately, no. You won’t be able to do that unless you put a bunch more work into creating a server page, using the hubspot api, then pulling the menu items in dynamically with javascript.


tim@belch.io

Thanks very much. Is there any documentation on that?

No, they don’t have docs on that, and they don’t even have docs on the advanced menu api endpoint. Sorry for all the bad news. If there’s anything we (the community) can do to help you migrate your css to use the hubspot classes, let us know.


tim@belch.io

Ah okay, thank you again for the support, really appreciate the feedback!

No problem @evanshunt

If you found it helpful, please mark as solved :grinning_face_with_smiling_eyes:


tim@belch.io