QUANTM7 Docs
QuillObjects

Linklist & Link

The linklist and link objects for navigation menus and dropdowns.

Menus are stored as linklists. Each one has a handle and a set of links. Links can be nested to build dropdowns.

PropertyTypeDescription
linklist.idnumberThe unique menu ID
linklist.handlestringThe menu handle (e.g. main-menu)
linklist.titlestringThe menu title
linklist.linksarrayThe top-level links
PropertyTypeDescription
link.titlestringThe link text
link.urlstringThe URL the link points to
link.typestringThe link type (see below)
link.activebooleantrue if this link matches the current page
link.linksarrayChild links (for dropdown menus)
link.visibilitystringWho can see this link: everyone, logged_in, logged_out, members_only
link.badge_textstringBadge text displayed on the link (e.g. "New")
link.badge_colorstringBadge color value
TypeDescription
collection_linkPoints to a collection
product_linkPoints to a product page
page_linkPoints to a static page
blog_linkPoints to a blog
blog_post_linkPoints to a specific blog post
policy_linkPoints to a policy page
url_linkPoints to an external or custom URL
headingA label that is not a link (used to group items)

Building a navigation menu

{% assign main_menu = linklists['main-menu'] %}
<nav>
  {% for link in main_menu.links %}
    <a href="{{ link.url }}" {% if link.active %}class="active"{% endif %}>
      {{ link.title }}
      {% if link.badge_text %}
        <span class="badge" style="background: {{ link.badge_color }}">
          {{ link.badge_text }}
        </span>
      {% endif %}
    </a>

    {% if link.links.size > 0 %}
      <ul class="dropdown">
        {% for child in link.links %}
          <li><a href="{{ child.url }}">{{ child.title }}</a></li>
        {% endfor %}
      </ul>
    {% endif %}
  {% endfor %}
</nav>

Links can be set to show only for some visitors. Use the visibility field to check:

{% for link in main_menu.links %}
  {% if link.visibility == 'logged_in' and customer == nil %}
    {% continue %}
  {% endif %}
  {% if link.visibility == 'logged_out' and customer %}
    {% continue %}
  {% endif %}
  {% if link.visibility == 'members_only' and customer.tier == 'standard' %}
    {% continue %}
  {% endif %}

  <a href="{{ link.url }}">{{ link.title }}</a>
{% endfor %}
{% assign footer_menu = linklists['footer'] %}
{% if footer_menu %}
  <div class="footer-links">
    {% for link in footer_menu.links %}
      <a href="{{ link.url }}">{{ link.title }}</a>
    {% endfor %}
  </div>
{% endif %}

Accessing menus

Use the global linklists object to access any menu by its handle:

{% assign account_menu = linklists['account'] %}
{% assign mobile_menu = linklists['mobile'] %}

On this page