I’m trying to set the date front matter in a hugo new command, but I’m just can’t recall how it works.
The idea is that I would do something like hugo new /2008-01-15-daily/index.md --another-thing=2008-01-15 and using archetypes/default.md it would produce, at content/2008-01-15-daily/index.md:
---
title: "Daily entry for 2008-01-15"
date: 2008-01-15
---
How do we pass commandline parameters to front matter, via archetypes?
:filename
Fetches the date from the content file’s filename. For example, 2018-02-22-mypage.md will extract the date 2018-02-22. Also, if slug is not set, mypage will be used as the value for .Slug.
Option 2
archetypes/default.md
title = '{{ replace .Name "-" " " | title }}'
date = {{ or (os.Getenv "HUGO_DATE") .Date }}
draft = false