This week I set out to come up with a way to automatically publish future-dated posts to your website, and wanted to share my results with you.
At first, I was looking at the static post scheduler from Serverless. This is a neat solution, but I didn’t like the need to create a pull request in order to publish the post.
The solution I came up with is to future-date posts that I want to publish in the future, and then just automatically run a rebuild+redeploy of the site at regular intervals.
I wrote an article for Forestry talking about the strategy and provided two solutions for accomplishing this: Automatically Publish Scheduled Posts For Your Static Site
The first solution is to use a CircleCI workflow to automatically run your deployment, which is super easy to set up if you’re already deploying with CircleCI.
The second solution is a serverless function that will work with any CI tool you have hooked up to your Github repo, because it just pushes a commit at the interval you specify. Maybe it’s not the most elegant solution, but it’s pretty universal.
If you’ve been trying to figure out how to automatically publish your scheduled posts, I hope you find this useful!
DIsclaimer: I work for Forestry .io