v0.24
This is The Revival of the Archetypes!
"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:
- 17839+ stars
- 493+ contributors
- 166+ themes
Notes
- Archetype files now need to be complete, including
title
anddate
. - The
-f
(format) flag inhugo new
is removed: Now use the archetype files as is.
Enhancements
- Support extension-less media types. The motivation behind this change is to support Netlify's
_redirects
files, so we can generate server-side redirects for the Hugo docs site. See this commit to see how we configured that. 0f40e1fa @bep #3614 - Add
disableAliases
516e6c6d @bep #3613 - Support non-md files as archetype files 19f2e729 @bep #3597 #3618
- Identify extension-less text types as text c43b512b @bep #3614
- Add
.Site
to the archetype templates 662e12f3 @bep #1629 - Use archetype template as-is as a Go template 422057f6 @bep #452 #1629
- Update links to new discuss URL 4aa12390 @bep
Fixes
- Fix error handling for
JSON
front matter fb53987a @bep #3610 - Fix handling of quoted brackets in
JSON
front matter 3183b9a2 @bep #3511
Automated with @goreleaser
Built with go version go1.8.3 darwin/amd64