JMKelley
JMKelley

Reputation: 658

Shopify: Displaying a list of all collections on collection page

I'm trying to make a clickable list of all collections on my collection page, but for some reason the following isn't working?

{% for collection in collections %}
    {% collection.title %}
{% endfor %}

Upvotes: 0

Views: 3032

Answers (1)

Josh Brown
Josh Brown

Reputation: 4096

You can output a variable with double curly braces, like this: {{ collection.title }}

This snippet would give you a list of collections with links:

<ul>
{% for collection in collections %}
  <li>{{ collection.title | link_to: collection.url }}</li>
{% endfor %}
</ul>

You can learn more about Liquid syntax here: https://shopify.github.io/liquid/basics/introduction/

Upvotes: 1

Related Questions