Skip to content

Instantly share code, notes, and snippets.

@lukecathie
Created December 18, 2014 09:36
Show Gist options
  • Save lukecathie/2b4eaad90467b3a7c266 to your computer and use it in GitHub Desktop.
Save lukecathie/2b4eaad90467b3a7c266 to your computer and use it in GitHub Desktop.
Jekyll sort collections by date desc
{% assign work_items = site.work_items | sort: 'date' | reverse %}
{% for work_item in work_items limit:4 %}
<div>
<a href="{{ work_item.url | prepend: site.baseurl }}">{{ work_item.title }}</a>
</div>
{% endfor %}
@grrseguin
Copy link

👍

@Chetabahana
Copy link

Chetabahana commented May 19, 2018

Possible also to add weight. e.g., weight: 100
{% assign work_items = site.work_items | sort: 'weight' %}

@SeanFromIT
Copy link

👍

@jtoy
Copy link

jtoy commented Dec 22, 2019

thanks!

@akshayKhot
Copy link

Thanks!

@garraflavatra
Copy link

thanks!

@leedh
Copy link

leedh commented Jan 7, 2022

Thank you! Helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment