Skip to content

Instantly share code, notes, and snippets.

@jconnoll
Created December 6, 2011 02:23
Show Gist options
  • Save jconnoll/1436411 to your computer and use it in GitHub Desktop.
Save jconnoll/1436411 to your computer and use it in GitHub Desktop.
Shopify - In product page get the collection it's in
{% for link in linklists[settings.sidebar_linklist_1].links %}{% for p in collections[link.object.handle].products %}{% if p.title == product.title %}{% assign: collectionName = link.object.handle %}{% endif %}{% endfor %}{% endfor %}
{% for link in linklists[settings.sidebar_linklist_1].links %}
<li><a href="{{ link.url }}"{% if link.url == active_url %} class="current"{% endif %}{% if template == 'article' and link.url == blog.url %} class="current"{% endif %}{% if collection.url == link.url %} class="current"{% endif %}
{% if link.handle == collectionName %} class="current"{% endif %}
>{{ link.title }}</a></li>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment