Hugo 0.24: The Revival of the Archetypes!

Sorry, I can not make it any clearer. Maybe other can chime in with a better explanation, else see the documentation.

2 Likes

Seems pretty clear to me. Looking forward to the next release.

@bep This is awesome, especially #1629. Default taxonomies pulled from site variables, multiple fields for scheduling (e.g., with now and AddDate), etc are going to help archetypes be a fully actualize feature.

This is only food for thought w/r/t how content typing is done with really large sites built in non-SSG CMSs. I’m not suggesting this is necessarily feasible, or even worthwhile, for Hugo:

  1. Multiple archetypes that inherit from a single parent archetype (e.g. person => staff, author, volunteer)
  2. Archetypes independent of section. For example, if I have event and article content types (i.e. archetypes) and want to generate/scaffold an instance of both within the same section. This would lend itself to pre-development content and entity-relationship modeling, which are often part of large business sites.

I’m not sure how either of these could be accomplished with 1) file-based content typing and 2) Hugo’s current data model that associates sections and type auto-magically, so take this as you will.

Regardless, looking forward to this awesome new feature and v24! :smile:

@RobertCvn This explanation of archetypes may help you. They aren’t called “archetypes” because they “arch” over the site. In informational science, an archetype is “a formal, re-usable model of a domain concept.” (See Wikipedia.)

I have a fairly set scope for what I want to do here, and I envision a fairly short time frame for this release.

1 Like

As I mentioned, just food for thought. I wouldn’t dare try to force feed you. I think these improvements are going to be awesome. Thanks, Bjorn!

I think @RobertCvn is looking for a way to pass changes made in an archetype file to all existing content files that were made from it. I agree that this is a separate issue from preserving field order, but it would be a nice feature on its own. Is there a good way to push archetype file changes out to existing content files that the archetype should apply to?

How do you know if a content file is created from an archetype file? What you really are talking about, which is also a separate issue, is some “front matter inheritance”.

2 Likes

I would assume that the archetype matches either the type as defined in the file, or the folder that the content file is in.
I realize this isn’t always the case, but I think that could be a working assumption for the request.