Skip to content

Instantly share code, notes, and snippets.

@devinhalladay
Last active August 29, 2015 13:56
Show Gist options
  • Save devinhalladay/9296154 to your computer and use it in GitHub Desktop.
Save devinhalladay/9296154 to your computer and use it in GitHub Desktop.
Use this code to manually sort posts with Jekyll, using Liquid only.
layout weight title description
post
1
Title
This is a post!

Even though this post is much older than the other, it will appear first in the post list! Magic! Witchcraft!

layout weight title description
post
2
Title
This is a post!

This post is more recent than the other, but it will appear second in the post list! Wowza!

{% for weight in (1..20) %}
{% for post in site.posts %}
{% if post.weight == weight %}
{% if post.categories contains 'work' %}
<a href="{{ post.url }}">{{ post.title }}</a>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment