Skip to content

Instantly share code, notes, and snippets.

@kyleaparker
Created February 6, 2014 20:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyleaparker/8851659 to your computer and use it in GitHub Desktop.
Save kyleaparker/8851659 to your computer and use it in GitHub Desktop.
Shopify: Map all collection tags (avoid 50 product limit)
{% assign collection_tags = collection | map: 'tags' %}
{% for tag in collection_tags %}
<a href="/collections/{% if collection.handle != blank %}{{ collection.handle }}{% else %}all{% endif %}/{{ tag | handleize }}" title="{{ tag | escape }}">{{ tag }}</a>
{% endfor %}
@kyleaparker
Copy link
Author

@darryn sorry just saw this!

Yup you can create an array of product titles. You would use something like:

{% assign all_products = collections.all.products | map: 'title' %}
{% for title in all_products %}
{{ title }}
{% endfor %}

I looks like it doesn't work with tags, possibly because collection.tags is already an array? Like this:

{% for tag in collection.tags %}
{{ forloop.index }}
{% endfor %}

However, your example would work like this:

{% assign collection_titles = collections.all.products | map: 'title' %}

{% for title in collection_titles %}
{{ forloop.index }} {{ title }}
{% endfor %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment