jekyll,

How to show future dated posts in Jekyll

Jan 10, 2022 · 1 min read · Post a comment

By default, Jekyll doesn’t display posts with future dates. Sometimes we want to test them before publishing, and for that reason there is a plain solution.

Prerequisites

  • Jekyll

Solution

Let’s start by saying you need to test a post with tomorrow’s date, for example: 2022-01-11-docker-vs-podman.md.

When previewing post locally, you’ll get the following message:
Skipping: _posts/2022-01-11-docker-vs-podman.md has a future date.

The solution is quite simple. Just add the –future flag. Full command(s) below:

jekyll serve --future

or

bundle exec jekyll serve --future

Regarding the production environment (GitHub Pages for instance), add the following line in your _config.yml file found in the root directory:

future: true

Conclusion

As a next step, if you really don’t want to bother with all the above, a simple CI/CD cron job should do the job, by deploying every midnight in the preferred timezone by the website/blog owner. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.