Documentation ¶
Index ¶
- Variables
- func FromFileToMap(fs afero.Fs, filename string) (map[string]interface{}, error)
- func GetNumWorkerMultiplier() int
- func GetStringSlicePreserveString(cfg Provider, key string) []string
- func IsValidConfigFilename(filename string) bool
- func RenameKeys(m map[string]interface{})
- func SetBaseTestDefaults(cfg Provider)
- type Provider
- type Sitemap
Constants ¶
This section is empty.
Variables ¶
var (
ValidConfigFileExtensions = []string{"toml", "yaml", "yml", "json"}
)
Functions ¶
func FromFileToMap ¶ added in v0.54.0
FromFileToMap is the same as FromFile, but it returns the config values as a simple map.
func GetNumWorkerMultiplier ¶ added in v0.55.0
func GetNumWorkerMultiplier() int
GetNumWorkerMultiplier returns the base value used to calculate the number of workers to use for Hugo's parallel execution. It returns the value in HUGO_NUMWORKERMULTIPLIER OS env variable if set to a positive integer, else the number of logical CPUs.
func GetStringSlicePreserveString ¶ added in v0.42.1
GetStringSlicePreserveString returns a string slice from the given config and key. It differs from the GetStringSlice method in that if the config value is a string, we do not attempt to split it into fields.
func IsValidConfigFilename ¶ added in v0.54.0
IsValidConfigFilename returns whether filename is one of the supported config formats in Hugo.
func RenameKeys ¶ added in v0.54.0
func RenameKeys(m map[string]interface{})
RenameKeys renames config keys in m recursively according to a global Hugo alias definition.
func SetBaseTestDefaults ¶ added in v0.55.0
func SetBaseTestDefaults(cfg Provider)
SetBaseTestDefaults provides some common config defaults used in tests.
Types ¶
type Provider ¶
type Provider interface { GetString(key string) string GetInt(key string) int GetBool(key string) bool GetStringMap(key string) map[string]interface{} GetStringMapString(key string) map[string]string GetStringSlice(key string) []string Get(key string) interface{} Set(key string, value interface{}) IsSet(key string) bool }
Provider provides the configuration settings for Hugo.
func FromConfigString ¶ added in v0.42.1
FromConfigString creates a config from the given YAML, JSON or TOML config. This is useful in tests.