Calling Link List From Blocks

honeybadgermse
Tourist
19 0 2

Hello, can anyone help me?

I am quite new to Shopify so I will try and explain best I can. 

I have a page template called "page.sections-shop-kitesurf" here I am calling in a section with schema settings "{% section 'page-sections-shop-kitesurf' %}" an included another file like so: {% include 'page-template-blocks' %} which contains:

Loop for blocks

 

<div class="page-blocks">
  {% for block in section.blocks %}
    <div {{ block.shopify_attributes }}>
      {% case block.type %}

        {% when 'menu-item' %}
          {% include 'page-block-menu-item' %}  

      {% endcase %}
    </div>
  {% endfor %}
</div>

 

 

And I have another file which has the loop for the link list {% include 'page-block-menu-item' %} in this file I am trying to get the settings from the schema using the "type": "menu-item", handle like so?

 

 

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

 

 

I have defined a link_list menu in my schema settings like so:

 

 

{
        "type": "menu-item",
        "name": "Shop Menu",
        "settings": [
          {
            "type": "link_list",
            "id": "menu_items",
            "label": "Shop Menu"
          }
        ]
      },

 

 

Can anyone tell me where I have gone wrong or if this is even possible to do? I can change the menu handle to a menu created in the navigation and this works fine E.g main-menu but I want a template for a number of pages where each page you can assign a menu to it from the schema settings if that makes sense?

Appreciate the help if you can assist.

 

 

0 Likes