Table of Contents

I (sometimes) have a lot of ideas, rarely follow through on them in the moment, and usually forget them later.  So I made a secret drafts page that lists all the content pages on this site when I run the site locally with the -D flag.

The drafts markdown page.🔗

So that I can have the drafts list easily hide when not running with drafts enabled, and so I can easily have it shown in the main nav menu.

The important parts of content/drafts.md

[...]
draft: true <!-- Don't show this page in the prod environment -->
menu: main <!-- Include this page in the main menu -->
---
[...]

{{< list-drafts >}} <!-- The shortcode that does everything! -->

The drafts shortcode.🔗

It’s basically a taxonomy page!
But doing it this way means I don’t have to fiddle around with having a taxonomy page that pulls by draft.  I don’t have to tag draft pages (and then inevitably forget to un-tag them).  Nor do I have to figure how to make the taxonomy only sometimes visible.

<table>
<!-- Get all of our pages that have draft set to true -->
{{ range where $.Site.RegularPages "Params.draft" true }}
	<tr>
		<!-- Say what type of page they are -->
		<td>{{ .Type }}</td> 
		<!-- And link! -->
		<td style="padding-left: 20px"><a href="{{ .RelPermalink }}">{{ .Params.title }}</a></td>
	</tr>
{{ end }}
</table>

This could possibly be fancied up to also check if page title == this page title so that the markdown page we made doesn’t show in the list, but ehh.

Title Hugo Drafts Page
Created 2024-10-28
Published 2024-10-29
Draft false

Tags: Hugo, HTML, Website Customisation