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.

I'm launching a board game. If you'd like to know when it launches feel free to signup to my mailing list:

Mailing List

I hate spam just as much as you do and will probably never send an email out because I consider myself spam.