mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Create a struct with all of Hugo's config options
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes #10896 Closes #10620
This commit is contained in:
@@ -24,7 +24,6 @@ import (
|
||||
|
||||
"github.com/gohugoio/hugo/cache/filecache"
|
||||
|
||||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
@@ -100,8 +99,8 @@ func (ns *Namespace) getRemote(cache *filecache.Cache, unmarshal func([]byte) (b
|
||||
}
|
||||
|
||||
// getLocal loads the content of a local file
|
||||
func getLocal(url string, fs afero.Fs, cfg config.Provider) ([]byte, error) {
|
||||
filename := filepath.Join(cfg.GetString("workingDir"), url)
|
||||
func getLocal(workingDir, url string, fs afero.Fs) ([]byte, error) {
|
||||
filename := filepath.Join(workingDir, url)
|
||||
return afero.ReadFile(fs, filename)
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ func (ns *Namespace) getResource(cache *filecache.Cache, unmarshal func(b []byte
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b, err := getLocal(url, ns.deps.Fs.Source, ns.deps.Cfg)
|
||||
b, err := getLocal(ns.deps.Conf.BaseConfig().WorkingDir, url, ns.deps.Fs.Source)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user