Skip to content

Instantly share code, notes, and snippets.

@fredryk
Created January 8, 2013 19:47
Show Gist options
  • Save fredryk/4487260 to your computer and use it in GitHub Desktop.
Save fredryk/4487260 to your computer and use it in GitHub Desktop.
A fix to display both link-list and tag generated navigation in the sidebar of the Clearflex theme. Many thanks to Caro (https://github.com/carolineschnapp) for her outstanding help and direction!
<!-- in collection-nav.liquid, replace this for loop code -->
{% for link in linklists.[settings.linklist_collections].links %}
<li class="collection{% if settings.show_collection_tags and link.object.all_tags.size > 0 %} dropdown{% endif %}">
<a href="{{ link.url }}"{% if link.active %} class="current"{% endif %}>{{ link.title | escape }}</a>
{% capture child_list_handle %}{{ link.title | handleize }}{% endcapture %}
{% if linklists[child_list_handle] and linklists[child_list_handle].links.size > 0 %}
<ul class="collection-tags">
{% for l in linklists[child_list_handle].links %}
<li><a href="{{ l.url }}">{{ l.title | escape }}</a></li>
{% endfor %}
</ul>
{% elsif settings.show_collection_tags and link.object.all_tags.size > 0 %}
<ul class="collection-tags">
{% for tag in link.object.all_tags %}
<li><a href="{{ link.url }}/{{ tag | handle }}">{{ tag | escape }}</a></li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
<!-- in collection-list.liquid, replace this for loop code -->
{% for link in linklists[settings.linklist_collections].links %}
<li class="collection{% if link.active %} current{% endif %}">
<a href="{{ link.url }}">{{ link.title }}</a>
{% assign link_is_active = false %}
{% assign has_drop_down = false %}
{% assign list = '' %}
{% capture child_link_list %}{{ link.title | handle }}{% endcapture %}
{% if linklists[child_link_list].links.size > 0 %}
{% assign has_drop_down = true %}
{% for l in linklists[child_link_list].links %}
{% capture temp %}{{ list }} {{ l.title }} {% endcapture %}
{% assign list = temp %}
{% endfor %}
{% if list contains page_title %}
{% assign link_is_active = true %}
{% endif %}
{% endif %}
{% if link.active or link_is_active %}
{% if has_drop_down %}
<ul class="collection-tags">
{% for l in linklists[child_link_list].links %}
<li{% if l.active %} class="current"{% endif %}><a href="{{ l.url }}">{{ l.title }}</a></li>
{% endfor %}
</ul>
{% elsif settings.show_collection_tags and link.object.all_tags.size > 0 %}
<ul class="collection-tags">
{% for tag in link.object.all_tags %}
<li{% if current_tags contains tag %} class="current"{% endif %}><a href="{{ link.url }}/{{ tag | handle }}">{{ tag }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
</li>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment