summaryrefslogtreecommitdiffstats
path: root/create
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2014-10-12 15:57:00 +0200
committerspf13 <steve.francia@gmail.com>2014-10-15 12:40:12 -0400
commit0167fb480317749e24a7a5feb22a8d4e475873ce (patch)
tree2936c394a5718ab287a6d9d435551665daffb570 /create
parentda5d98e958a1e5bf3082b55d5d3ae41ac60f6490 (diff)
Copy content from archetype
Prior to this commit only metadata were copied from archetype on content creation. This commit includes the content if set in archetype. This is useful in situations with similar page structure. Fixes #556
Diffstat (limited to 'create')
-rw-r--r--create/content.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/create/content.go b/create/content.go
index 95bccb01e..449d63b85 100644
--- a/create/content.go
+++ b/create/content.go
@@ -34,7 +34,7 @@ func NewContent(kind, name string) (err error) {
location := FindArchetype(kind)
- var by []byte
+ var by []byte
if location != "" {
by, err = ioutil.ReadFile(location)
@@ -96,7 +96,7 @@ func NewContent(kind, name string) (err error) {
page.Dir = viper.GetString("sourceDir")
page.SetSourceMetaData(newmetadata, parser.FormatToLeadRune(viper.GetString("MetaDataFormat")))
-
+ page.SetSourceContent(psr.Content())
if err = page.SafeSaveSourceAs(path.Join(viper.GetString("contentDir"), name)); err != nil {
return
}
@@ -119,7 +119,7 @@ func FindArchetype(kind string) (outpath string) {
for _, x := range search {
// If the new content isn't in a subdirectory, kind == "".
- // Therefore it should be excluded otherwise `is a directory`
+ // Therefore it should be excluded otherwise `is a directory`
// error will occur. github.com/spf13/hugo/issues/411
var pathsToCheck []string