# A simple solution for publishing scheduled posts

**URL:** <https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842>\
**Category:** tips & tricks\
**Created:** [May 4, 2018, 4:43pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842 "2018-05-04T16:43:26Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwalkr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dwalkr/32/5807_2.png) [@dwalkr](https://discourse.gohugo.io/u/dwalkr)\
**Post date:** [May 4, 2018, 4:43pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/1 "2018-05-04T16:43:26Z")

</div>

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](https://serverless.com/blog/static-site-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](https://forestry.io/blog/automatically-publish-scheduled-posts-for-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!](https://forestry.io/blog/automate-deploy-w-circle-ci/))

[The second solution](https://github.com/dwalkr/serverless-autopublish) 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](http://Forestry.io)_

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [May 4, 2018, 4:49pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/2 "2018-05-04T16:49:01Z")

</div>

I just have this little IFTTT recipe 😄

_(Click below image to see the full recipe.)_

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/c/c0628dbad585740bcaa101e0a24004752ed1d19c.png)

---

<div class="post-metadata">

**Author:** ![dwalkr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dwalkr/32/5807_2.png) [@dwalkr](https://discourse.gohugo.io/u/dwalkr)\
**Post date:** [May 4, 2018, 4:50pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/3 "2018-05-04T16:50:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [May 4, 2018, 4:52pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/4 "2018-05-04T16:52:51Z")

</div>

> [@dwalkr](#):
>
> What do you use to deploy the site?

The hint’s in there 😉

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

---

<div class="post-metadata">

**Author:** ![dwalkr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dwalkr/32/5807_2.png) [@dwalkr](https://discourse.gohugo.io/u/dwalkr)\
**Post date:** [May 4, 2018, 4:55pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/5 "2018-05-04T16:55:00Z")

</div>

🤦‍♂️ TIL how thumbnails work

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [May 4, 2018, 4:56pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/6 "2018-05-04T16:56:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jura](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jura/32/13581_2.png) [@Jura](https://discourse.gohugo.io/u/Jura)\
**Post date:** [May 9, 2018, 2:50pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/7 "2018-05-09T14:50:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [May 9, 2018, 2:53pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/8 "2018-05-09T14:53:02Z")

</div>

> [@Jura](#):
>
> For what topics do you guys/gals use scheduled posts?

I don’t use scheduled posts, but I schedule to rebuild my site everyday so that [this page](https://ox-hugo.scripter.co/doc/examples/) has the most current “last updated” dates (fetched using GitHub/Gitlab API via `getJSON`).

---

<div class="post-metadata">

**Author:** ![hellbox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hellbox/32/5795_2.png) [@hellbox](https://discourse.gohugo.io/u/hellbox)\
**Post date:** [May 9, 2018, 2:56pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/9 "2018-05-09T14:56:15Z")

</div>

Thanks for writing this, @dwalkr. I’m currently porting [seattlereviewofbooks.com](http://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.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/totallyinformation/32/5668_2.png) [@TotallyInformation](https://discourse.gohugo.io/u/TotallyInformation)\
**Post date:** [May 9, 2018, 3:23pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/10 "2018-05-09T15:23:38Z")

</div>

> [@Jura](#):
>
> 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 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.

---

<div class="post-metadata">

**Author:** ![iveptawebadmin](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@iveptawebadmin](https://discourse.gohugo.io/u/iveptawebadmin)\
**Post date:** [May 17, 2018, 6:37pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/11 "2018-05-17T18:37:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iveptawebadmin](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@iveptawebadmin](https://discourse.gohugo.io/u/iveptawebadmin)\
**Post date:** [May 17, 2018, 6:39pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/12 "2018-05-17T18:39:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jura](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jura/32/13581_2.png) [@Jura](https://discourse.gohugo.io/u/Jura)\
**Post date:** [May 18, 2018, 1:21pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/13 "2018-05-18T13:21:20Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![dwalkr](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dwalkr/32/5807_2.png) [@dwalkr](https://discourse.gohugo.io/u/dwalkr)\
**Post date:** [May 18, 2018, 2:40pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/14 "2018-05-18T14:40:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RickCogley](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rickcogley/32/10269_2.png) [@RickCogley](https://discourse.gohugo.io/u/RickCogley)\
**Post date:** [June 27, 2018, 1:32pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/15 "2018-06-27T13:32:20Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![raw](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/raw/32/22319_2.png) [@raw](https://discourse.gohugo.io/u/raw)\
**Post date:** [September 18, 2023, 2:36am UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/16 "2023-09-18T02:36:23Z")

</div>

FWIW, I use a similar approach, except with the GitHub CI to host Hugo via Cloudflare Pages. The advice on the Cloudflare Discord was to use a webhook, so like @kaushalmodi I have a IFTTT that simply pings my CF Pages webhook in the middle of the night to rebuild.

(and when I’m getting ready to commit, I locally build with `hugo server --buildFuture`.)

what i want to set up next is for my preview builds on CF Pages to also run with the `--buildFuture` flag, so then I can QC everything on a staging server before the prod server updates…just haven’t gotten around to this yet.

---

<div class="post-metadata">

**Author:** ![Arif](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/arif/32/20931_2.png) [@Arif](https://discourse.gohugo.io/u/Arif)\
**Post date:** [September 18, 2023, 3:00pm UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/17 "2023-09-18T15:00:46Z")

</div>

You can use a cron job service to run the webhook. I use [Cron Job](https://cron-job.org/).

---

<div class="post-metadata">

**Author:** ![fgandiya](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fgandiya/32/10119_2.png) [@fgandiya](https://discourse.gohugo.io/u/fgandiya)\
**Post date:** [September 20, 2023, 10:01am UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/18 "2023-09-20T10:01:41Z")

</div>

To schedule posts i just have a cron job that runs every morning which I schedule all my future posts to.

I used to have a custom CI script which would modify the cron settings to then publish the post at any given time but that got complicated.

---

<div class="post-metadata">

**Author:** ![saitor](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@saitor](https://discourse.gohugo.io/u/saitor)\
**Post date:** [July 17, 2024, 6:42am UTC](https://discourse.gohugo.io/t/a-simple-solution-for-publishing-scheduled-posts/11842/19 "2024-07-17T06:42:59Z")

</div>

If you’re looking for a different solution that rebuilds your site at the specific time a post has to go live or a post has to be expired, here’s a tutorial:

> **[Scheduling Hugo Builds with AppScript and Node | BusinessAddons.com](https://businessaddons.com/guides/automate-hugo-site-rebuilds-efficient-scheduling-guide/)**
>
> Comprehensive guide on automating Hugo builds using AppScript, NodeJS and a build hooks.

Been using this solution for over a year, and finally wrote about it!
