Scheduling Posts With Hugo and Netlify

After I moved this blog from Ghost to Hugo I wanted to find a way to schedule posts in the future. This is pretty easy with Netlify.

The trick is to use the front-matter on your markdown files to specify a date in the future then use IFTTT to call the Netlify webhook to trigger a rebuild. Hugo will only generate the post if the current date is in the past.

For example, if using JSON:

date: 2019-01-09T18:00:00Z

I only do this weekly to avoid unnecessary rebuilds and power usage. If you don’t have a regular posting schedule then you could do something smarter by parsing the front-matter to generate a cron schedule for builds.

You can preview your posts by using the -F flag when running Hugo. You can also use the -D flag to preview drafts. The only problem is that if your post is both in the future and a draft then it won’t show in either the drafts or future lists when using the hugo list command.

You could also use a Pull Request (or Merge Request if you are using GitLab, which is a better name) workflow. Netlify will build a preview site in this case, which gives you a slightly better idea of how the post will look when live and online. There is a guide for that here.

If you want to syndicate your new post out to social media silos then you could look into IndieWeb POSSE and Bridgy. You may also want to support responses to your posts with webmentions.

[Valid RSS]

Join the other subscribers on my email list to learn about new blog posts!