How to display sub menu as a linked lists dynamically on collection pages ?

How to display sub menu as a linked lists dynamically on collection pages ?

AdamAnas
Shopify Partner
35 1 7

Im using this Code to display Top Nav menu on the collection page, 

 

 

{% for link in linklists.main-menu.links %}
<a href="{{ link.url }}">{{ link.title }}</a>
{% endfor %}

 

 

I want to display submenus here as linked list, corresponding to the collection pages, how can i tweak the codes

 

Replies 2 (2)

MyLUCA
Excursionist
18 0 9

I think I do have the same problem.

I can now only click on the collections itself in the menu. But not on the collection list. That only opens the sub menu, but does not link to the collection list.

Viken-Lakkad
Shopify Partner
1 0 0

<ul class="parent">
  {% for link in linklists.main-menu.links %}
  <li><a href="{{ link.url }}">{{ link.title }}</a>
  {% if link.links != blank %}
    <ul class="child">
      {% for child_link in link.links %}  
      <li><a href= "{{ child_link.url }}">{{ child_link.title }}</a>
      {% if child_link.links != blank %}
        <ul class="grandchild">
        {% for grandchild_link in child_link.links %}  
          <li><a href= "{{ grandchild_link.url }}">{{ grandchild_link.title }}</a></li>
        {% endfor %}
        </ul>
      {% endif %}  
      </li>
      {% endfor %}
    </ul>
  {% endif %}
  </li>
  {% endfor %}
  </ul>