Creating a pseudo-section for "drafts"

Hi folks, I am planning to compile a site with --buildDrafts, but

  • I don’t want the drafts to be included in section/list.html template by default
    (I guess I can use {{ range where .Pages "draft" "!=" true }} to filter the posts in pagination etc).

  • I want drafts to be still compiled to the output, but instead of /blog/hello-world, I want the draft posts to go to /drafts/hello-world/. (I’m not sure how to do this.)

An option: I can create a new section (content/drafts/, in addition to content/posts/) but then I wouldn’t be using draft: true anymore.

What would be your tip to get where I want the easiest way? (I’m still new to Hugo architecture so haven’t fully wrapped my mind about the possibilities yet.)

Instead of using the draft param, you could use the type param and set it to something custom. Then in your templates, filter on where "Type" == "foo"

Thanks. How do I then somehow create a /drafts/ directory with these posts compiled into it based on that “type” parameter?

Create a list template at


Also, configure the permalink for type draft to be what you want.

From Hugo 0.60 (hopefully) this will be more straight forward as these changes are planned:

  • recursive draft behaviour
  • new nolist and norender flags that can be set in markdown, can be made recursive by putting them in the cascade section

Hi, I just came across a few threads (like List all posts but drafts or Keeping drafts out of the rss feed), I’m still fuzzy on how to actually make it happen.

I would like to build future and draft posts content, but not list them in the usual lists (tags, rss, posts), however I would like to list then in a specific path (e.g. host.tld/d/). So I’d like to hide draft posts anywhere exept when explicitly asked.

  1. Currently I’m having difficulty to just create a list in a /d/ path, I have tried various combinations
  • content/d/ or without
draft = true 
title = "Drafts" 

  • layouts/d/index.html or layouts/d/list.html
{{ define "header" }}
    {{ partial "header.html" . }}
{{ end }}

{{ define "content" }}
    {{ partial "drafts/content.html" . }}
{{ end }}

{{ define "footer" }}
    {{ partial "page-list/footer.html" . }}
{{ end }}

<!-- -->
  • layouts/partials/drafts/content.html
<span class="section__title">{{ .Title }}</span>
<ul class="posts drafts">
    {{ $paginator := .Paginate (where (where .Site.Pages "Type" "in" "posts") "Draft" true ) }}
    {{ partial "pagination.html" . }}
    {{ range $paginator.Pages }}
        <span class="list__title--small">
            <time class="hidden-tablet">{{ .Date.Format (.Site.Params.dateformat | default "Jan 02 '06") }}</time>
            <a href="{{ .RelPermalink }}" {{if .Draft}}class="draft"{{end}}>{{ .Title }}</a>
    {{ end }}

But of course the given setup is wrong, either the HTML is empty or the page only contains what’s but nothing else. Did I missed something in

But then even if it works I’ll probably have to go through every template to filter drafts right ?