Lego2012
9/26/2016 - 9:20 PM

List of Categories used in a Collection

List of Categories used in a Collection

<!-- 
This loop loops through a collection called `collection_name`
and sorts it by the front matter variable `date` and than filters
the collection with `reverse` in reverse order

To make it work you first have to assign the data to a new string
called `sorted`. 
-->

<ul>
  {% assign sorted = (site.collection_name | sort: 'date') | reverse %}
  
  {% for item in sorted %}
    <li>{{ item.categories }}</li>
  {% endfor %}
</ul>