Working with Draft Posts

Hugo has a built in mechanism for draft postings. This allows you to work on a post and not publish it until you are ready. Great for when you’re dipping in and out of writing.

This is a setting that sits in your post, in the top section. Our example below shows you how to do this with yaml.

title: "My Draft Post"
date: 1970-01-01
url: /my draft-post/
draft: true
my content

That last line, draft: true means the post won’t be listed and generated as part of the hugo build. You can work on it in your own time until you’re ready.

An alternative way, is to set the date in the future. This will act in a similar way (but it will mean when the date passes the post will surprisingly show up!).

How can I see my Draft Posts?

If you run the serve command with the “buildDrafts” property, like shown below, then draft builds will be included your blog roll to access it.

hugo server --buildDrafts

Hope that works for you, happy writing!