summaryrefslogtreecommitdiffstats
path: root/parser
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-18 19:06:28 +0200
committerGitHub <noreply@github.com>2017-06-18 19:06:28 +0200
commit422057f60709696bbbd1c38c9ead2bf114d47e31 (patch)
tree2d2a40f403559b226b826c49a82bb2993313c2c9 /parser
parent4aa1239070bb9d4324d3582f3e809b702a59d3ac (diff)
create: Use archetype template as-is as a Go template
This commit removes the fragile front matter decoding, and takes the provided archetype file as-is and processes it as a template. This also means that we no longer will attempt to fill in default values for `title` and `date`. The upside is that it is now easy to create these values in a dynamic way: ```toml +++ title = {{ .BaseFileName | title }} date = {{ .Date }} draft = true +++ ``` You can currently use all of Hugo's template funcs, but the data context is currently very shallow: * `.Type` gives the archetype kind provided * `.Name` gives the target file name without extension. * `.Path` gives the target file name * `.Date` gives the current time as RFC3339 formatted string The above will probably be extended in #1629. Fixes #452 Updates #1629
Diffstat (limited to 'parser')
-rw-r--r--parser/frontmatter.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/parser/frontmatter.go b/parser/frontmatter.go
index 627d5ef49..ab56b14d1 100644
--- a/parser/frontmatter.go
+++ b/parser/frontmatter.go
@@ -13,6 +13,8 @@
package parser
+// TODO(bep) archetype remove unused from this package.
+
import (
"bytes"
"encoding/json"