Skip to content

Instantly share code, notes, and snippets.

@pootsbook
Created August 13, 2014 14:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pootsbook/2e3a097e563c4a9fc970 to your computer and use it in GitHub Desktop.
Save pootsbook/2e3a097e563c4a9fc970 to your computer and use it in GitHub Desktop.
Sorting custom collections in Jekyll
# Two files, default sort order is alphabetical ascending on file name.
# _config.yml
collections:
albums:
output: true
# _albums/audio_video_disco.md
---
title: Audio, Video, Disco
sortable: 2
---
# _albums/cross.md
---
title: Cross
sortable: 1
---
# index.md
---
---
<ul>
{% assign posts = site.albums | sort: "sortable" %}
{% for post in posts %}
<li>{{post.title}}</li>
{% endfor %}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment