Archetypal Bundles

The new image processing feature is very powerful with regard to the generation of responsive images. In fact, image processing is so useful I’ve begun to move port my entire site over to use the new pattern.

Moving to the new leaf and branch bundle pattern comes with a cost, however:

  1. The hugo new command is no longer as useful as it once was in scaffolding content.
  2. Repetitious manual work is required to create, for example, an images folder inside a bundle.

What are your thoughts, if any, on enhancing Archetypes such that they can be used to scaffold not just the basic front matter associated with the generation of pages, but entire leaf or branch bundles?

Example Bundle Archetype:

In the archetypes directory:

  resources/.gitkeep # containing frontmatter

With the above the CLI would do something like this:

hugo new post/my-post

Would result in something like:

/content/post/my-post/images/ # dotfiles ignored?
1 Like

Similar have been discussed, and I want to just note that:

hugo new --kind post post/my-post/

Will work as expected and pick up the archetype.

And if your archetype template looks similar to this:

title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true

You will get a sensible title.

There are (at least) 2 reasons why your suggestion is hard to implement in a simple way:

  1. Lanaguage selection. This may be easier once Hugo 0.38 gets out, but you need a way to select content languge.
  2. Markdown selection (Asciidoc)

So an improvement in this area will have to be done in a way that does not make me have to do:

hugo new --language no --format asciidoc ... post/my-post


I got an idea how to do this. Will add an GitHub issue describing it shortly.

Archetype being a bundle itself ? :slight_smile:

I got the idea while I was skiing (downhill), is all I can say. I get all my best ideas skiing.

1 Like