buildDrafts is false but drafts are still being built

What could be causing this? I test the public version and a [draft] post shows up.

Working on Windows 10

config.toml has

buildDrafts = false

I have tested

  • Disabling all custom theme modifications
  • reducing the config files to absolute minimal
  • clearing public every time just to be sure, drafts still being built

I have now also tested making a fresh new project and using the same theme

Quick Start | Hugo followed steps here
GitHub - adityatelange/hugo-PaperMod: A fast, clean, responsive Hugo theme

Made a post, compiled without any extra changes, and draft still appear in public folder. Also tried another theme, still seeing drafts in public.

What am I misunderstanding?

Please share your repository. This will be a lot easier to diagnose if we have the complete picture.

Here is a stand alone starter project which still build drafts into public.

I downloaded, unzipped, cd’d into the project, then:

rm -rf public


├── categories
│   ├── page
│   │   └── 1
│   │       └── index.html
│   ├── index.html
│   └── index.xml
├── js
│   └── features.min.c5d8f3350f5a652f526b982306299353824299adb7a3bd261ecffacc47087f66.js
├── sass
│   └── main.min.4e90cee935c47394b47f9cb7ffe8e3ffab18b88d82fea203918cc3f92eec5eb2.css
├── tags
│   ├── page
│   │   └── 1
│   │       └── index.html
│   ├── index.html
│   └── index.xml
├── 404.html
├── index.html
├── index.xml
└── sitemap.xml

Neither of your posts were built, as expected.

Were you running hugo -D?

I am doing

hugo -D

to build, is that wrong?

Yes, that means include drafts.

1 Like

D’oh. Thank you.

I suggest editing the docs here to mention that -D is to include drafts. I should have read the docs for that command instead of assuming it was required to build.

Quick Start | Hugo


1 Like

I made pull request on the doc page which caused my confusion

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.