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.
1
2
3
4
5
6
7
---
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.
Edd is a PHP and Go developer who enjoys blogging about his experiences, mostly about creating and coding new things he's working on and is a big beliver in open-source and Linux.
Hide a Page in Hugo
–
Option 1: Draft The simplest way to hide a page when using Hugo is probably to set the post as a draft. This way, you still have the content ready to go for when you need it.
To hide a page by setting it as draft, so our drafts page:
Set Post as Draft Tutorial Option 2: Hide from Posts List You still want the page to be visible, but you don’t want to show it your blog posts list?
Show All Tags For a Post as a List
–
When showing your blog post, either as a single page or within a blog post list it can be nice to show the tags associated with that post (we do here on MakeWithHugo!). This is going to be a quick post (hopefully) showing you how to add your tags as a list and each linked up.
You can add this code to either your single.html layout file or inside the loop in list.