diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-06-22 20:39:55 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-06-22 22:00:42 +0200 |
commit | fd924d1802cb9c20c2617b1c72dac6bc36560d61 (patch) | |
tree | 890a074f2aa1eebee956ed3e8ac8db2b3ed19140 /create/content_template_handler.go | |
parent | e908d955d25cc5a2a5c783de4de569399773e23e (diff) |
commands: Create default archetype on new site
See #3626
Diffstat (limited to 'create/content_template_handler.go')
-rw-r--r-- | create/content_template_handler.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/create/content_template_handler.go b/create/content_template_handler.go index d8c1fc71c..fbe062cba 100644 --- a/create/content_template_handler.go +++ b/create/content_template_handler.go @@ -48,11 +48,13 @@ type ArchetypeFileData struct { } const ( - archetypeTemplateTemplate = `--- + ArchetypeTemplateTemplate = `--- title: "{{ replace .TranslationBaseName "-" " " | title }}" date: {{ .Date }} draft: true ----` +--- + +` ) func executeArcheTypeAsTemplate(s *hugolib.Site, kind, targetPath, archetypeFilename string) ([]byte, error) { @@ -75,7 +77,7 @@ func executeArcheTypeAsTemplate(s *hugolib.Site, kind, targetPath, archetypeFile if archetypeFilename == "" { // TODO(bep) archetype revive the issue about wrong tpl funcs arg order - archetypeTemplate = []byte(archetypeTemplateTemplate) + archetypeTemplate = []byte(ArchetypeTemplateTemplate) } else { archetypeTemplate, err = afero.ReadFile(s.Fs.Source, archetypeFilename) if err != nil { @@ -105,7 +107,7 @@ func executeArcheTypeAsTemplate(s *hugolib.Site, kind, targetPath, archetypeFile s.Log.FEEDBACK.Println(fmt.Sprintf(`WARNING: date and/or title missing from archetype file %q. From Hugo 0.24 this must be provided in the archetype file itself, if needed. Example: %s -`, archetypeFilename, archetypeTemplateTemplate)) +`, archetypeFilename, ArchetypeTemplateTemplate)) } |