Update : I published a simpler workflow for this, using Hugo’s build options that I wasn’t aware of, because they are relatively new.
A few friends and I run a weekly writing club similar to this. Once we have our drafts ready, we usually share them for reviews, etc.
Previously, I used to use Nikola, and it’s default behaviour is what worked well for this workflow – share the posts URL with reviewers, but the post shouldn’t appear in the feed, post list, etc.
If you set the status metadata field of a post to
draft, it will not be shown in indexes and feeds. It will be compiled, and if you deploy it it will be made available, so use with care. If you wish your drafts to be not available in your deployed site, you can setDEPLOY_DRAFTS = Falsein your configuration.
I moved to using Hugo a few years ago. By default, it doesn’t publish the draft
posts, but you could ask it to do so using the --buildDrafts option. But, that
doesn’t do what I want – draft posts are treated just like any other post, and
they appear in the feeds, post list, etc.
Given how fast hugo builds are, though, it is pretty easy to hack-up the
behaviour I want.
-
Run a build with drafts, say to
devdirectory.DEV_DIR="dev" # Build drafts to dev dir hugo --cleanDestinationDir -D -d "${DEV_DIR}" > /dev/null -
Run a build without drafts, to
publicdirectory.PUBLIC_DIR="public" hugo --cleanDestinationDir -d "${PUBLIC_DIR}" -
Copy the drafts from the
devbuild to thepublicbuildrsync -ri --ignore-existing "${DEV_DIR}"/ "${PUBLIC_DIR}" -
Deploy the
publicbuild
The code above is here as a single script. Here is the full deployment script for my blog.