hugo/docs/content/news/0-24.md

4.2 KiB

date categories description link title draft author
2017-06-17T17:53:58-04:00
Releases
The Revival of the Archetypes! Hugo 0.24 false bep

"A feature that could be the name of the next Indiana Jones movie deserves its own release," says @bep.

Hugo now handles the archetype files as Go templates. This means that the issues with sorting and lost comments are long gone. This also means that you will have to supply all values, including title and date. But this also opens up a lot of new windows.

A fictional example for the section newsletter and the archetype file archetypes/newsletter.md:

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

**Insert Lead paragraph here.**

<!--more-->

## New Cool Posts

{{ range first 10 ( where .Site.RegularPages "Type" "cool" ) }}
* {{ .Title }}
{{ end }}

And then create a new post with:

hugo new newsletter/the-latest-cool.stuff.md

Note: the site will only be built if the .Site is in use in the archetype file, and this can be time consuming for big sites.

Hot Tip: If you set the newContentEditor configuration variable to an editor on your PATH, the newly created article will be opened.

The above newsletter type archetype illustrates the possibilities: The full Hugo .Site and all of Hugo's template funcs can be used in the archetype file.

Also, Hugo now supports archetype files for all content formats, not just markdown.

Hugo now has:

Notes

  • Archetype files now need to be complete, including title and date.
  • The -f (format) flag in hugo new is removed: Now use the archetype files as is.

Enhancements

Fixes