One of the trade­offs of us­ing a sta­tic site gen­er­a­tor like Jekyll is not hav­ing sched­uled posts. Sure you can add a date in the fu­ture, but sta­tic means ex­actly that, there’s no dy­namic part to find and com­pare dates and times. Without com­plex hacks, I had­n’t found an easy way to do sched­uled posts with Jekyll. That is, un­til now.

As of Jekyll 3, the --future flag is dis­abled on build. This means that if you give a post a date in the fu­ture, it’ll be ex­cluded from the build un­til the time is ei­ther equal to or af­ter the date you set. Sweet! We can set the post date to some­time in the fu­ture, then trig­ger a de­ploy af­ter that time. This is where Zapier comes in.

Zapier al­lows you to cre­ate trig­gers at a cer­tain time of the day, so I have a trig­ger set for 6am and 12noon. Zapier then trig­gers a de­ploy on Netlify at those times every­day1. You can add trig­gers for how­ever many times you’d like to re­build the site. I usu­ally post twice a day so I only have two setup. In my posts, I set the time to like 5:45am or 11:50am so that when the trig­gers run, these new posts will be in­cluded in the build.

And there you have it! Scheduled posts in Jekyll with no dif­fi­cult (or frag­ile) hacks.

  1. Zapier will even let you pick if you want this trig­ger to hap­pen on week­ends. ↩︎

Series Hacking Jekyll

As I learn things about Jekyll, I try to write about them.

View Series →

Up Next