Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-01-10 12:55:03 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-04 07:37:25 +0300
commitc71e1b106e6011d148cac899f83c4685dee33a22 (patch)
treec5c7090f0c2398c7771e4908ebcc97aa7714ffd2 /create/content.go
parent0ada40591216572b0e4c6a8ab986b0aa4fb13c13 (diff)
all: Refactor to nonglobal file systems
Updates #2701 Fixes #2951
Diffstat (limited to 'create/content.go')
-rw-r--r--create/content.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/create/content.go b/create/content.go
index 195080d88..6a03c8c9b 100644
--- a/create/content.go
+++ b/create/content.go
@@ -34,15 +34,15 @@ import (
// NewContent creates a new content file in the content directory based upon the
// given kind, which is used to lookup an archetype.
-func NewContent(fs afero.Fs, kind, name string) (err error) {
+func NewContent(s *hugolib.Site, kind, name string) (err error) {
jww.INFO.Println("attempting to create ", name, "of", kind)
- location := FindArchetype(fs, kind)
+ location := FindArchetype(s.Fs.Source, kind)
var by []byte
if location != "" {
- by, err = afero.ReadFile(fs, location)
+ by, err = afero.ReadFile(s.Fs.Source, location)
if err != nil {
jww.ERROR.Println(err)
}
@@ -62,9 +62,7 @@ func NewContent(fs afero.Fs, kind, name string) (err error) {
return err
}
- site := hugolib.NewSiteDefaultLang()
-
- page, err := site.NewPage(name)
+ page, err := s.NewPage(name)
if err != nil {
return err
}