I’ve made a cool javascript library which filters items by date client-side. The benefit to this is that it gives the illusion that your site is dynamic. Have an upcoming event that’s actually in the past and still showing on your site? This library will hide it.

I recommend using it in conjunction with the static Liquid date filter below.

Static liquid filter

Use this in your template to filter posts by current date:

    {% capture now %}{{'now' | date: '%s' | plus: 0 %}}{% endcapture %}
    {% for post in site.posts %}
      {% capture date %}{{post.date | date: '%s' | plus: 0 %}}{% endcapture %}
      {% if date > now %}
      {% endif %}
    {% endfor %}

This code captures the current time (at build time) into the now variable and only activates if the date of the post is larger (in the future). date: '%s' captures the date as a timestamp and plus: 0 ensures that any string values are cast to integers.

Method originally from here.

Kickstarter Coming March 2018

I'm launching a board game called Delivery Duck. You're a duck, in a truck, delivering packages. It's a strategic family game for 2 to 6 players.

Check out the board game!