A simple solution for publishing scheduled posts

This week I set out to come up with a way to automatically published future-dated posts to your website.

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. Especially considering Hugo already respects the publishdate parameter to determine if it should publish a post or not, it seemed a little redundant to also schedule the publish date in a PR.

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 (I wrote an article about that too!)

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. (Do I get bonus points for writing it in Go?)

If you’ve been trying to figure out how to schedule posts with your Hugo site, I hope you find this useful!

DIsclaimer: I work for Forestry.io


I just have this little IFTTT recipe :smile:

(Click below image to see the full recipe.)


That’s nice! What do you use to deploy the site?

The hint’s in there :wink:

ʎɟᴉlʇǝN :ɹǝʍsu∀

:man_facepalming: TIL how thumbnails work

1 Like

Ah, thanks for that feedback… You are right… it’s not evident that that image is hyperlinked to the full image… added a little note for that.

I’ve never been a big user of scheduled blog posts. For what topics do you guys/gals use scheduled posts? For instance, only special anniversary posts or also regular content?

I don’t use scheduled posts, but I schedule to rebuild my site everyday so that this page has the most current “last updated” dates (fetched using GitHub/Gitlab API via getJSON).

Thanks for writing this, @dwalkr. I’m currently porting seattlereviewofbooks.com to Hugo, and we’ll both need a friendly editor, and a future publishing solution — our entire site is run on future publishing. I’ll look into some of these options when I’m ready to figure that part out.

I typically don’t use them. However, I do tend to write posts in splurges since one idea will kick off a load of others. It is generally best for SEO purposes, if you are seen to be posting regularly. So if you care about such things, you can write a bunch of posts when you feel inspired but spread the dates out then keep rebuilding daily.

I do the same thing and it works great! I set my build time to 3 AM since it was before anyone here would wake up and care, and it was past midnight for editors who like to burn the midnight oil.

1 Like

We use it for upcoming events, usually some number of days before the event. We also use this for regular posts along with an editorial calendar and future content planning.

Thanks for the comments. I like the idea of scheduling posts in advance, and automatically rebuild the website at certain intervals. But I’m not a big fan of all the cache purges that are needed to make that work. I need my website to be quick too. :slight_smile:

This is a good point. The shotgun solution is easy, but something more targeted (like a script that could know if/when there are scheduled posts to publish) wouldn’t deplete the cache so often

@dwalkr thanks for the post about scheduling circleci builds. That made it simple to schedule a daily build so I can undraft finished posts with a future date.

1 Like