config

package
v0.0.0-...-5b3a7c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ValidConfigFileExtensions = []string{"toml"}
)

Functions

func FromFileToMap

func FromFileToMap(fs afero.Fs, filename string) (map[string]any, error)

FromFileToMap is the same as FromFile, but it returns the config values as a simple map.

func GetNumWorkerMultiplier

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

func GetStringSlicePreserveString(cfg Provider, key string) []string

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.

Types

type KeyParams

type KeyParams struct {
	Key    string
	Params maps.Params
}

type Provider

type Provider interface {
	GetString(key string) string
	GetInt(key string) int
	GetBool(key string) bool
	GetParams(key string) maps.Params
	GetStringMap(key string) map[string]any
	GetStringMapString(key string) map[string]string
	GetStringSlice(key string) []string
	Get(key string) any
	Set(key string, value any)
	Merge(key string, value any)
	SetDefaults(params maps.Params)
	SetDefaultMergeStrategy()
	WalkParams(walkFn func(params ...KeyParams) bool)
	IsSet(key string) bool
}

Provider provides the configuration settings for Hugo.

func FromFile

func FromFile(fs afero.Fs, filename string) (Provider, error)

FromFile loads the configuration from the given filename.

func New

func New() Provider

New creates a Provider backed by an empty maps.Params.

func NewCompositeConfig

func NewCompositeConfig(base, layer Provider) Provider

NewCompositeConfig creates a new composite Provider with a read-only base and a writeable layer.

func NewFrom

func NewFrom(params maps.Params) Provider

NewFrom creates a Provider backed by params.

type Sitemap

type Sitemap struct {
	ChangeFreq string
	Priority   float64
	Filename   string
}

Sitemap configures the sitemap to be generated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL