From 422057f60709696bbbd1c38c9ead2bf114d47e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 18 Jun 2017 19:06:28 +0200 Subject: 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 --- parser/frontmatter.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'parser') 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" -- cgit v1.2.3