Archetypes vs. `draft = true`

While going through the docs and testing the output of hugo new, I notice a possible discrepancy:

  • Without archetype, hugo new creates a new file with date, draft = true and title populated in the front matter.

  • With archetype, hugo new adds date and title (in addition to whatever is in the archetype) to the front matter. No draft = true is added.

Is it intentional? Or is it an oversight?

Many thanks for your help!

It is intentional. The archetype should set its own value for all fields. Only exceptions are date which is set by now always and title which is provided by the user through the file name.

Steve Franciaspf13.com@spf13

1 Like

Thank you for your clarification, Steve!

I intend to add this little note near the end of http://gohugo.io/content/archetypes/:

Note: hugo new does not automatically add draft = true when the user provides an archetype. This is by design, rationale being that the archetype should set its own value for all fields. title and date, which are dynamic and unique for each piece of content, are the sole exceptions.

in case any users were wondering about the same. :slight_smile:

Cheers,
Anthony

1 Like