On The Deprecations in 156 page the deprecation of .Site.BuilDrafts is explained.
Is there no way to find out if hugo was run in the -D mode? (I had been using this to enable some debugging information even on non-draft pages).
When I include the draft pages, other things change (e.g., with more pages, various lists pagenate differently), so I like to have a visual reminder.
bep
April 8, 2026, 7:12pm
2
The only way I can come up with is to create a dumy draft (and headless) page in e.g. content/isdraft.md and then:
{{ if site.GetPage "isdraft" }}
// we're in draft mode.
{{ end }}
Or something.
2 Likes
Thanks! That works. I should probably improve my workflow, rather than trying to cling to old ways of doing things.
bep
April 8, 2026, 8:25pm
4
Yea, well – we understood that removing this would probably break something, but Site.BuildDrafts felt very incomplete without also reporting on the other similar flags (build expired/future). We may find a place for all of those 3 in the API somewhere if enough people shout …
I appreciate that you care about the aesthetics of the system - it’s part of the reason I keep using it!
My use case is weird.
1 Like