Collections groups on Index

Highlighted
New Member
1 0 0
I've been scouring the internet and this forum for a solution to this, and I can't seem to find one. How can I create a for loop which iterates through all my collections, one at a time? Here's what I'm trying to do... On the Index page, I would like to show clusters of products (not all of them) for each collection I have, each cluster to have the title of the collection to which they belong link to that full collection. For instance:

BOOKS & PRINTED
    (linked image 1) (description & price)
    (linked image 2) (description & price)
    (linked image 3) (description & price)
    (linked image 4) (description & price)

CLOTHING
    (linked image 1) (description & price)
    (linked image 2) (description & price)
    (linked image 3) (description & price)
    (linked image 4) (description & price)
I would like to do this with several for loops, but I'm having a heck of a time dynamically pulling, displaying and linking the data for each collection. I'm currently using linklists, but then in the nested for loop for the products, I need to dynamically define which collection of products is being pulled, and there is no link.handle to be able to pull to insert into that string (why, I have no idea). So it starts like this:

{% for link in linklists.categories.links %}

{{ link.title | link_to: link.url }}
{% for product in collections.books-printed.products | limit: 4 %} The rest is fairly standard. But in the for loop for the products, I need that to be dynamic:

{% for product in collections.##########.products | limit: 4 %}
Is there an easier way to do this? We will be expanding and adding more categories and subcategories as we go, and I don't want to have to hardcode that information into the Index layout only to have to update it again later. Having this be dynamic as things expand will be crucial. Any input? Thanks! -wt
0 Likes