Archetypes: not what I expected

When I created an archetype file for my blog posts, what I thought would happen is that the entire file would be copied into the new article, with a date and title added. Instead, the archetype is processed, and the resulting non-empty front matter variables are inserted. No comments, no neatly-formatted front matter, no sample body. It does at least preserve the <!--more--> separator, but I have a hunch that’s by accident rather than design.

Basically, I wanted this:

+++
date = "(inserted by hugo new)"
title = "(inserted by hugo new)"
categories = [ 
  "books",
  "drink",
  "food",
  "games",
]
# uncomment to add tags
# tags = [ "" ]
#
# uncomment to add to a series
# series = [ "" ]
#
# set to some N for sticky posts
# weight = 
#
#remove this to publish
draft = true
+++

<!--more-->

But I got this:

+++
title = "(inserted by hugo new)"
categories = ["books","drink","food","games"]
draft = true
date = "(inserted by hugo new)"

+++

<!--more-->

Instead of being able to quickly edit down the nicely-formatted category list, uncomment a line to add taxonomy references, and see the reminder to delete draft status when I’m ready to publish, I get a blog. [edited: my earlier claim about the body not being preserved was user error; I had conflicting archetype files in the theme and the site]

So, not a bug, just a surprise, and not having a good feel for Hugo’s roadmap (if there is one), all I can really do is ask, “are archetype files useful in their current form?”.

Archetypes are useful in its current form.

But I agree, this has room improvements – and there are several issues describing a fix for this, the closest maybe

I have waited for someone to pick up the ball and … fix it.

I’ve edited the original to catch my own mistake: the body text is being inserted, it’s just that I had both theme and site archetypes that were identical except for the body. I was maintaining it in the theme, and forgot that I had created the site-specific version earlier.

So it’s really just the front matter that I’m complaining about. :slightly_smiling:

-j

We will fix that.