Discreet Drafts

Hello fellow hugo-ers.

I’m experimenting with making my draft posts public (for easier unadvertised sharing), and thought I’d writeup my workflow, on the off chance it’s useful.

All feedback is welcome. Also, thanks to @davidsneighbour for early review :slight_smile:

From the summary:

I sometimes pass around blog post drafts to friends and family for review. It’s usually by email or text, which is fine. Yet it would be cool if I could give them a real link. A discreet draft , if you will.

I did a bit of searching on the Hugo Discourse forums, and of course, I was not the first person with this idea. A few others had implemented custom solutions, but I didn’t see a writeup of how to do it from scratch. When encountering a knowledge gap like this, my tutorial-spidey-sense tingles, and I knew it was time to take a stab.

The tutorial


The sitemap would be the next place that might show these posts (depending on the used template). As far as I understand the default template might show these draft posts due to the buildDrafts setting.

I will play around with the system tomorrow, no time now :wink: But we might want to add to the internal templates, that drafts are never included explicitly.


@davidsneighbour Thanks for bringing that up. I’ve addressed it, as well as a few other cleanup items.

1 Like

For fun, added (naive) password protection

1 Like

I think, we should amend robots.txt as follows:

User-agent: *
Disallow: /drafts/

Otherwise the drafts may show up on search results, which can be terrible.

Or add a noindex meta tag to draft posts via header-layout file.

@Sid / @davidsneighbour - thanks for pointing that out and for the ideas. Will play with this and let you know.

Have a look at GitHub - dnb-org/dnb-hugo-robots - I will add disallows via frontmatter by post/page in a bit and also check for frontmatter-draft properties. I did modify dnb-hugo-sitemap to check for draft status already earlier. The idea in general is great for publishing workflows without too much hassle or “external websites helping”.

I went with the noindex meta tag.

1 Like

Hi @zwbetz, hi all,

I’m using these solutions with PaperMod and published a branch.

Thanks for sharing, cheers!

1 Like