Draft set to true in branch bundle is exported


I’m still getting the draft export problem. I upgraded to latest latest 0.59 and it still happens.

Any new draft or existing ones set to true are still exported to public when built. And the files have content, they are not empty.
No, I don’t use taxonomies.
Yes, I cleaned my public folder everytime.

This is my config.toml

baseURL = ""
languageCode = "en-us"
canonifyURLs = false
copyright = 2019
assetDir = "./"
title = "Some title"
ignoreFiles = [ "\\.git$", "\\.git" ]
disableKinds = ["taxonomy", "taxonomyTerm"]
relativeURLs = false

A draft frontmatter looks like this:

bg: "pt-3 pt-md-5 mt-md-5"
bttmTrackingCta: ""

title: "Some title"
description: "Interdum montes bibendum venenatis enim libero sed tortor litora justo ad posuere, neque at aliquam pharetra ligula auctor ac massa velit platea, nec mattis curabitur nibh etiam scelerisque nunc vestibulum praesent netus. Fermentum mollis elementum mus orci suspendisse finibus netus primis, risus etiam urna penatibus tempus euismod vivamus id consequat, faucibus fames magnis luctus sed malesuada condimentum.."
imageURL: "/"
linkURL: "/"
Seo: "noindex,nofollow"

# Content Types
type:               ""     
layout:             ""
draft: true

weight: 2

Tree looks like this

    ├── content/
    │   ├── draft-page
    │       ├── _index.md   
    ├── layouts/
    │   ├── draft-page
    │       └── draft-page.html

hugo list drafts returns a list of the draft page.
Sitemap adds entries of the drafts. It still adds entries after I deleted the draft page - wtf?

I don’t remember changing anything related to drafts, is there something that I’m missing?
What other info can I include for debugging and how?

I am unaware of the draft export problem and I use Hugo drafts on a daily basis.

You need to provide a link to a repository with the source code of your project.

The config is not enough.

Let me make you aware of the draft export problem:

Unfortunately I can’t provide a repo since this is a private company repository and I’m also not allowed to publish the code. I will get back with a dummy repo and try to remove confidential information from it.

Here are a couple thoughts:

  • Run hugo version before you build your site to make sure you are using the latest hugo
  • What command flags are you using when you build your site? I recommend using --ignoreCache and --gc (garbage collector) and --cleanDestinationDir.
  • Is there any file in your staticDir(s) that might be copied to your built site that are causing this?
  • Try deleting any resources directory.

Let us know if you figure this out!

If draft-page is supposed to be a RegularPage, then you probably want index.md, not _index.md, there.


Thank you _nm for the suggestions. I tried all of them but nothing worked.
I stripped down my repository to 2 draft pages and one to be published.

My repository is here:

I get the same problem for this repo.
Additionally I also discovered that “hugo server -D” doesn’t work also.

I’m thinking this is a hugo problem and my next action will be to reinstall Hugo with Brew.

You have defined branch bundles (or section lists -whatever terminology you prefer-) as drafts.

At the moment:

Sections defines the structure of the content tree. You currently cannot remove the branch you’re sitting on.

The above quote is from https://github.com/gohugoio/hugo/issues/6312 which will be addressed in a future version of Hugo.

If you need to disable these sections and all of their children I suggest that you enter them in the ignoreFiles array of your config.

P.S. I have renamed the topic title accordingly.

1 Like

@alexandros is right. If you want “leaf bundles” (also known as Regular Pages), structure your pages either like this (which includes three “leaf bundles”):

|   |   _index.md  ←note underscore
|   |
|   +---comisioane/
|   |   index.md  ←note no underscore
|   |
|   +---cont-si-card/
|   |   index.md  ←note no underscore
|   |
|   \---nfc2/
|       index.md  ←note no underscore

Or equivalently like this (which does not use “leaf bundles”):

|   |   _index.md
|   |   comisioane.md
|   |   cont-si-card.md
|   |   nfc2.md

Note that the draft key works in either of the above directory structures (even in v0.59.0) :tada:

IMHO, it is best to avoid using a leaf bundle unless you actually need a directory for, e.g. resources, for a RegularPage.

IMHO2, it is best to avoid the terminology “leaf bundle” and “branch bundle” and instead use terms like “RegularPage” and “List Page” - I’m not sure what is good terminology but I’m pretty sure it does not include any of these strings: “leaf”, “branch”, “node” :scream: … Maybe good terms are “RegularPage (bundle)”, “RegularPage (non-bundle)” and “List Page”.

IMHO3: Terminology is hard.

IMHO4: If there were a Hugo FAQ, the distinction between index.md and _index.md would be #1.


This worked before Hugo 0.57.
The fact that I’m using it wrong, I’m aware of.
I still don’t see anyone mention that this changed after 0.57 update.

At my company, Hugo was somehow forced into our workflow, although we just have a static site, with a few pages. Nothing related to articles or a blog type, which I think Hugo is more suited for.

So the most I have in regards to subpages is:
homepage -> our credit cards
homepage -> account details -> something more about the account

And how I use it is exactly like this.
In content I have folders for each subpage, with _index.md being my homepage.
In layout I have folders for each subpage, with index.html being my homepage.

Is there any other way I should structure my content to enable drafts?


If you need to disable these sections and all of their children I suggest that you enter them in the ignoreFiles array of your config.

This is such an ugly way of hardcoding things. I mark something if it’s a draft, not by the name it is sitting on.

I downloaded and built your site with Hugo v0.59.0 and drafts work if you rename _index.md to index.md for your Regular (non List) Pages. I edited my comment above so it now includes

←note no underscore

in the relevant parts of your directory structure.

It’s weird that your current directory structure worked before :thinking:


Thank you _nm . This is the solution and things work back normally again.
As I said, I’m aware I was not using the leaf/branches normally (stupid terminology to be honest, or if you want to go this route, have a small drawing in your documentation showcasing examples of a tree and what a branch would look like as a folder, what a leaf would look like etc.).

Not sure why it worked before, but I did try to install 0.56 and drafts were working (probably it was not supposed to).

Anyway, thank you again for your help.

1 Like

One only needs to search “bundles” in Hugo docs and they should land up on:

A table showing the distinction between index.md and _index.md is the first thing on that page.

If you scroll down on that page, you’ll find examples too. If you really want to help, please provide a PR to improve these docs.

By the way, what part of that documentation were you not able to understand. Feedback is welcome.

There are guidelines in this forum that need to be adhered to so that this forum is a civilized place for discussion.

Comparing the Hugo Documentations to something made for robots.txt is akin to trolling as far as I am concerned.

@aysun you really need to make an effort to be more polite in this forum if you wish to continue being a member here. This is a warning.

1 Like