Jekyll produces static HTML… but what if we want to filter content by the current date? Say we have a list of events and want to hide past events. The following 2 options have you covered.
Static liquid filter
Use this in your template to filter
posts by current date:
This code captures the current time (at build time) into the
now variable and only shows the post if its
date is larger than
now (in the future). The
date: '%s' filter captures the post’s date as a timestamp and
plus: 0 ensures that any string values are cast to integers. (Method from Stack Overflow).
Of course this filtering still only happens whenever Jekyll is built…