hacks-guide-minimal-mistake.../_includes/documents-collection.html
Nicolas Elie 6282bd9221
Allow custom sorting for collections (#2723)
* Allow custom sorting for collections

* Update docs with custom sort of collections

* Refactoring
2021-02-05 20:37:31 -05:00

16 lines
371 B
HTML

{% assign entries = site[include.collection] %}
{% if include.sort_by %}
{% assign entries = entries | sort: include.sort_by %}
{% endif %}
{% if include.sort_order == 'reverse' %}
{% assign entries = entries | reverse %}
{% endif %}
{%- for post in entries -%}
{%- unless post.hidden -%}
{% include archive-single.html %}
{%- endunless -%}
{%- endfor -%}