Skip to content

Instantly share code, notes, and snippets.

@lukecathie
Created December 18, 2014 09:36
Show Gist options
  • Select an option

  • Save lukecathie/2b4eaad90467b3a7c266 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

๐Ÿ‘

@Chetabahana
Copy link
Copy Markdown

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
Copy Markdown

๐Ÿ‘

@jtoy
Copy link
Copy Markdown

jtoy commented Dec 22, 2019

thanks!

@akshayKhot
Copy link
Copy Markdown

Thanks!

@garraflavatra
Copy link
Copy Markdown

thanks!

@leedh
Copy link
Copy Markdown

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