Just a short post this time, with something I recently setup with Hugo and GitLab, but it easily applies to any other static site generator and CI/CD runner1.


So as you may already know or have guessed, this blog is built using Hugo, and is hosted on GitLab! There’s documentation on this already, so I won’t rehash that2. No, I’m here to talk about posting, in the future.

When you’re writing a post in Hugo, you can set the post date to a time in the future, but unless you have the buildFuture configuration set, the Hugo won’t build that post.

Why would you want to set a date in the future? Maybe you know you’ll be away and unable to post for a few weeks, or you’re just feeling productive and write a heap of content. Instead of overwhelming your readers with a tower of posts released on the same day, you could stagger that content over several weeks.

But here’s the thing. With the default configuration following the documentation linked earlier, the blog only builds when the pipeline runs, which means you making a new commit to the main branch.

When I’m away, I’m away! 😎 🌴 I can’t be triggering these builds!

Happily, GitLab lets you set timer. They’re called pipeline schedules, and you can either set one with the ever powerful cron syntax or one of their default options. I’m using 0 20 * * * in the UTC timezone, meaning about 4am local.

So I can just write, set the date I want and make sure to remove the draft status and… fresh posts for the people when they rise and shine! ☕


  1. Probably. ↩︎

  2. Unless you want me to! Let me know on Twitter or something. ↩︎