Skip to content

Instantly share code, notes, and snippets.

@budparr
Last active July 25, 2016 01:49
Show Gist options
  • Save budparr/70ee9bd784b3598a41dfa17485f96f5c to your computer and use it in GitHub Desktop.
Save budparr/70ee9bd784b3598a41dfa17485f96f5c to your computer and use it in GitHub Desktop.
Jekyll Events, with limiting posts
{% assign events = "" | split: "|" %}
{% for item in site.posts %}
{% assign current_date = site.time | date: "%Y%m%d" %}
{% assign postdate = item.date | date: "%Y%m%d" %}
{% if postdate > current_date %}
{% assign events = events | push: item %}
{% endif %}
{% endfor %}
{% assign upcoming_events = events | sort: 'date', 'last' | reverse %}
{% for object in upcoming_events limit: 10 %}
//stuff here
{% endfor %}
{% comment %}
this technique may be superceded by the where_exp filter in 3.2
{% endcomment %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment