Instantly share code, notes, and snippets.
Created
May 21, 2016 15:55
-
Save panoply/89ab8f21bae5e1d158ccffe990986106 to your computer and use it in GitHub Desktop.
Sidebar Filter using Liquid for BRIXTOL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
{% for tag in collection.tags %} | |
{% if | |
tag != 'Bomber' | |
and tag != 'Autumn / Winter' | |
and tag != 'Spring / Summer' | |
and tag != 'Coat' | |
and tag != 'Duffel' | |
and tag != 'Parka' | |
and tag != 'Sport Jacket' | |
and tag != 'Long Bomber' | |
and tag != 'Heritage' | |
and tag != 'Linen' | |
and tag != 'Shetland Wool' | |
and tag != 'Teddy Wool' | |
and tag != 'Waxed Cotton' | |
and tag != 'Sweater' %} | |
{% capture name %}{{ tag }}{% endcapture %} | |
{% unless name contains 'Color' %} | |
{% if current_tags contains tag %} | |
<li class="filter--active"> | |
{{ tag | link_to_remove_tag: tag }} | |
</li> | |
{% else %} | |
<li> | |
{{ tag | link_to_add_tag: tag }} | |
</li> | |
{% endif %} | |
{% endunless %} | |
{% endif %} | |
{% endfor %} | |
</ul> | |
<ul> | |
{% for tag in collection.tags %} | |
{% if tag != 'Bomber' | |
and tag != 'Coat' | |
and tag != 'Duffel' | |
and tag != 'Parka' | |
and tag != 'Heritage' | |
and tag != 'Long Bomber' | |
and tag != 'Sport Jacket' | |
and tag != 'Men' | |
and tag != 'Women' | |
and tag != 'Unisex' | |
and tag != 'Linen' | |
and tag != 'Long Bomber' | |
and tag != 'Shetland Wool' | |
and tag != 'Teddy Wool' | |
and tag != 'Waxed Cotton' | |
and tag != 'Sweater' %} | |
{% capture name %}{{ tag }}{% endcapture %} | |
{% unless name contains 'Color' %} | |
{% if current_tags contains tag %} | |
<li class="filter--active"> | |
{{ tag | link_to_remove_tag: tag }} | |
</li> | |
{% else %} | |
<li> | |
{{ tag | link_to_add_tag: tag }} | |
</li> | |
{% endif %} | |
{% endunless %} | |
{% endif %} | |
{% endfor %} | |
</ul> | |
<ul> | |
{% comment %} | |
And for the good stuff, loop through the tags themselves. | |
{% endcomment %} | |
{% for tag in collection.tags %} | |
{% if | |
tag != 'Autumn / Winter' | |
and tag != 'Spring / Summer' | |
and tag != 'Men' | |
and tag != 'Women' | |
and tag != 'Unisex' | |
and tag != 'Linen' | |
and tag != 'Shetland Wool' | |
and tag != 'Teddy Wool' | |
and tag != 'Waxed Cotton' | |
and tag != 'Sweater' %} | |
{% capture name %}{{ tag }}{% endcapture %} | |
{% unless name contains 'Color' %} | |
{% if current_tags contains tag %} | |
<li class="filter--active"> | |
{{ tag | link_to_remove_tag: tag }} | |
</li> | |
{% else %} | |
<li> | |
{{ tag | link_to_add_tag: tag }} | |
</li> | |
{% endif %} | |
{% endunless %} | |
{% endif %} | |
{% endfor %} | |
</ul> | |
<ul> | |
{% for tag in collection.tags %} | |
{% if | |
tag != 'Bomber' | |
and tag != 'Long Bomber' | |
and tag != 'Coat' | |
and tag != 'Duffel' | |
and tag != 'Parka' | |
and tag != 'Heritage' | |
and tag != 'Sport Jacket' | |
and tag != 'Men' | |
and tag != 'Women' | |
and tag != 'Unisex' | |
and tag != 'Autumn / Winter' | |
and tag != 'Spring / Summer' | |
and tag != 'Sweater' %} | |
{% capture name %}{{ tag }}{% endcapture %} | |
{% unless name contains 'Color' %} | |
{% if current_tags contains tag %} | |
<li class="filter--active"> | |
{{ tag | link_to_remove_tag: tag }} | |
</li> | |
{% else %} | |
<li> | |
{{ tag | link_to_add_tag: tag }} | |
</li> | |
{% endif %} | |
{% endunless %} | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment