Last active
October 31, 2019 07:23
-
-
Save Chetabahana/25572d8d8fc7cdc25f4e9a3012db9287 to your computer and use it in GitHub Desktop.
This Liquid loop for Jekyll sorts the output of collection by category and weight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: default | |
--- | |
{% comment %} | |
* | |
* This loop loops through a collection called `feeds` with category 'section' | |
* and sorts it by the front matter variable 'weight' and than render | |
* each of the {{ output }} with their own layout | |
* | |
* To provide it with an online work you may see the running code here: | |
* https://github.com/chetabahana/chetabahana.github.io/blob/master/index.html | |
* | |
{% endcomment %}{% assign sections = site.feeds | sort: 'weight' | where_exp:"item", "item.category == 'section'" %} | |
{% for section in sections %} | |
{{ section.output }} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment