1
0
Fork 0
mirror of https://github.com/gohugoio/hugo.git synced 2025-04-22 00:58:08 +00:00

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 
This commit is contained in:
bep 2014-10-12 15:57:00 +02:00 committed by spf13
parent da5d98e958
commit 0167fb4803

View file

@ -34,7 +34,7 @@ func NewContent(kind, name string) (err error) {
location := FindArchetype(kind) location := FindArchetype(kind)
var by []byte var by []byte
if location != "" { if location != "" {
by, err = ioutil.ReadFile(location) by, err = ioutil.ReadFile(location)
@ -96,7 +96,7 @@ func NewContent(kind, name string) (err error) {
page.Dir = viper.GetString("sourceDir") page.Dir = viper.GetString("sourceDir")
page.SetSourceMetaData(newmetadata, parser.FormatToLeadRune(viper.GetString("MetaDataFormat"))) page.SetSourceMetaData(newmetadata, parser.FormatToLeadRune(viper.GetString("MetaDataFormat")))
page.SetSourceContent(psr.Content())
if err = page.SafeSaveSourceAs(path.Join(viper.GetString("contentDir"), name)); err != nil { if err = page.SafeSaveSourceAs(path.Join(viper.GetString("contentDir"), name)); err != nil {
return return
} }