Archetype is the template to create a markdown file. We can add more page variables for our convenience.
Version
Hugo 0.93.1
Default Archetype
archetypes/default.md
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---
default.md
is the default archetype file for hugo new
to create markdown file.
replace .Name "-" " " | title
: replace-
in the filename into space, and then pipe totitle
draft: false
: Hugo doesn’t generate the page for this markdown file
Modify default.md
archetypes/default.md
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: false
---
draft: true
: modifydraft
totrue
to make Hugo generate the page for this markdown file
We can add more page variables on
default.md
Conclusion
- There are still many features on archetype, but in most cases, simple
default.md
is enough