CrisC
CrisC

Reputation: 81

Shopify linklist show child pages of active page

I've set up sub-collections structure via Shopify menu's. This is what it looks like:

- Parent 1
  -- Child 1
  -- Child 2
      --- Grandchild 1
      --- Grandchild 2
  -- Child 3
      --- Grandchild 3
- Parent 2
- Parent 3

What I need is to only show the menu items one level lower. So for example:

What's the best way to make this work?

Upvotes: 0

Views: 845

Answers (1)

Shubham Vijay
Shubham Vijay

Reputation: 78

  {% for link in linklists.categories.links %} {% if link.url == collection.url and link.links != blank %}    <ul>
{% for child_link in link.links %}
  <li><a href= "{{ child_link.url }}">{{ child_link.title }}</a></li>
{% endfor %}</ul>{% else if link.links != blank %}{% for child_link in link.links %}{% if child_link.url == collection.url and child_link.links != blank  %}
   <ul>{% for grandchild_link in child_link.links %}  
    <li><a href= "{{ grandchild_link.url }}">{{ grandchild_link.title }}</a></li>
    {% endfor %}       </ul>
  {% endif %}    {% endfor %}  {% endif %} {% endfor %}

Upvotes: 1

Related Questions