A traditional CMS handles scheduling posts easily. Static site builders may not have the same features built in, but be able to schedule a post is still important.
There are plenty of ways of doing it of course. We have all the modern tools to achieve it. I use Vercel for most of my side projects (Read about Vercel Deploy Hooks), but for a recent use case I needed to schedule music tips on my site Jazztips which is hosted on Netlify
Let’s jump right into it.
Setup a build hook in Netlify
Visit Site settings → Build & deploy → Build hooks
Setup a webhook on GitHub
Select which events that should trigger the hook
Store the build hook as a GitHub secret
Create a GitHub Workflow
- Create a folder
.GitHub/workflows
- Inside, create a file
netlify.yml
name: Netlify Deploy
on:
schedule:
- cron: "0 13 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Trigger Netlify Hook
run: curl -X POST $
Select desired time interval e.g. “Every day at 1pm” (or similar). In the cURL command we use the NETLIFY_BUILD_URL
secret created earlier.
Gatsby, Jekyll or [insert static site builder/CMS of choice here]
For Jazztips I use Jekyll. Set future: false
in config.yml
. Posts with future dates in the front matter date: 2020-XX-XX
will only publish when the time is right 👍.
👉 Worth noting here is that some modern headless CMS has this built in their UIs.
Using Merge Schedule GitHub Action
Another option is this handy GitHub Action called Merge Schedule. It allows for mergeing pull requests on a scheduled day.
We can now schedule a merge by creating a pull request description with just one line:
/schedule YYYY-MM-DD
This will now schedule the pull request merge at YYY-MM-DD
Done!
Now you can see the “Daily cron job” beeing triggered the hook in your deploy logs. Make sure to setup Deploy Notifiations also to get notified when a deploy request is accepted/rejected/pending.
More great options
- The post scheduler is a serverless project that gives static site owners the ability to schedule posts (or other site content). It works with any static site setup (Jekyll, Hugo, Phenomic, Gatsby etc.)
- Vercel Serverless Functions
- Zapier: Schedule Zaps to run at specific intervals