I host this blog on Netlify. Often, I end up writing few blog posts on the same day, but not necessarily want all of them published together. Jekyll allows to add future date to the posts, and those posts will not get published until the date set. This lets me write blog posts on the same day, but publish them later based on the date set for the post.

However, this means that when you build the site (locally or on Netlify), posts with future dates will be skipped from the generated site. You will need to run build again on the blog post date to publish the blog posts. One way is to schedule a build on Netlify so that blog posts with future date can be included in the site. Curious how to do this?

Jekyll skipping posts with future date

Create Netlify build hook

Netlify supports build hooks, which lets you trigger new builds and deploys by making a request to a URL.

Configure build hooks

Go to Site Settings and Build Hooks section and click Add Build Hook button.

Add build hook

Give a name and select a branch to trigger the build and click Save. You will see the URL which you can use to trigger the build.

URL of the build hook

Create GitHub Actions workflow

Go to GitHub repo and create a actions yaml file under .github\workflows folder. GitHub Actions supports scheduled jobs, which lets you run a job at a specific time. See the below example. I am using cron expression to run the build every day at 04:00 AM UTC timezone.

name: nightly-netlify-build

on:
  schedule:
    - cron: "1 4 * * *"

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: trigger netlify build
        run: |
          curl -X POST -d '{}' https://api.netlify.com/build_hooks/2eae8d5c79506d0213a38be0e

Note, if you hover over the cron expression, GitHub nicely displays the tooltip explaining the cron expression.

GitHub shows cron expression detail

Save the file and push the changes. That is it, you have created a GitHub Actions workflow which can trigger nightly build of the blog. Go to Netlify and see the Deploys tab. You will see the deploys triggered by the build hook.

Deploys triggered by the build hook

Isn’t that cool? If you liked the post, do share it in your social channels. Thanks for reading.


About author
Utkarsh Shigihalli
Utkarsh Shigihalli
Utkarsh is passionate about software development and has experience in the areas of Azure, Azure DevOps, C# and TypeScript. Over the years he has worked as an architect, independent consultant and manager in many countries including India, United States, Netherlands and United Kingdom. He is a Microsoft MVP and has developed numerous extensions for Visual Studio, Visual Studio Code and Azure DevOps.
We Are
  • onlyutkarsh
    Utkarsh Shigihalli
    Microsoft MVP, Technologist & DevOps Coach


  • arora_tarun
    Tarun Arora
    Microsoft MVP, Author & DevOps Coach at Avanade

Do you like our posts? Subscribe to our newsletter!
Our Book