diff options
author | Albert Nigmatzianov <albertnigma@gmail.com> | 2016-11-07 00:10:32 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-11-07 00:10:32 +0100 |
commit | 85a2d81e3c1f62b561e6c2715cc406446879d09e (patch) | |
tree | 3ed54195fb0f8283082827a4890a138fca25504d /commands | |
parent | 4b4ab4755339a8c1d034be1f75b323d585dac1df (diff) |
commands, tpl: Get rid of repeating viper accesses
* all: Delete some blank lines
* commands, tpl: Get rid of repeating viper accesses
Diffstat (limited to 'commands')
-rw-r--r-- | commands/convert.go | 3 | ||||
-rw-r--r-- | commands/hugo.go | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/commands/convert.go b/commands/convert.go index a0424c4a9..411e51ec2 100644 --- a/commands/convert.go +++ b/commands/convert.go @@ -103,6 +103,7 @@ func convertContents(mark rune) (err error) { return fmt.Errorf("No source files found") } + contentDir := helpers.AbsPathify(viper.GetString("contentDir")) jww.FEEDBACK.Println("processing", len(site.Source.Files()), "content files") for _, file := range site.Source.Files() { jww.INFO.Println("Attempting to convert", file.LogicalName()) @@ -134,7 +135,7 @@ func convertContents(mark rune) (err error) { metadata = newmetadata } - page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("contentDir")), file.Dir())) + page.SetDir(filepath.Join(contentDir, file.Dir())) page.SetSourceContent(psr.Content()) if err = page.SetSourceMetaData(metadata, mark); err != nil { jww.ERROR.Printf("Failed to set source metadata for file %q: %s. For more info see For more info see https://github.com/spf13/hugo/issues/2458", page.FullFilePath(), err) diff --git a/commands/hugo.go b/commands/hugo.go index 883c92ea9..54d0a255e 100644 --- a/commands/hugo.go +++ b/commands/hugo.go @@ -426,7 +426,6 @@ func watchConfig() { } func build(watches ...bool) error { - // Hugo writes the output to memory instead of the disk // This is only used for benchmark testing. Cause the content is only visible // in memory @@ -786,7 +785,7 @@ func NewWatcher(port int) error { jww.FEEDBACK.Printf("Syncing all static files\n") err := copyStatic() if err != nil { - utils.StopOnErr(err, fmt.Sprintf("Error copying static files to %s", helpers.AbsPathify(viper.GetString("publishDir")))) + utils.StopOnErr(err, fmt.Sprintf("Error copying static files to %s", publishDir)) } } else { staticSourceFs := getStaticSourceFs() |