hugo: github.com/gohugoio/hugo/config Index | Files | Directories

package config

import "github.com/gohugoio/hugo/config"

Index

Package Files

commonConfig.go configLoader.go configProvider.go env.go

Variables

var DefaultBuild = Build{
    UseResourceCacheWhen: "fallback",
}
var (
    ValidConfigFileExtensions = []string{"toml", "yaml", "yml", "json"}
)

func FromFileToMap Uses

func FromFileToMap(fs afero.Fs, filename string) (map[string]interface{}, error)

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

func GetNumWorkerMultiplier Uses

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 Uses

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.

func IsValidConfigFilename Uses

func IsValidConfigFilename(filename string) bool

IsValidConfigFilename returns whether filename is one of the supported config formats in Hugo.

func RenameKeys Uses

func RenameKeys(m map[string]interface{})

RenameKeys renames config keys in m recursively according to a global Hugo alias definition.

func SetBaseTestDefaults Uses

func SetBaseTestDefaults(cfg Provider)

SetBaseTestDefaults provides some common config defaults used in tests.

func SetEnvVars Uses

func SetEnvVars(oldVars *[]string, keyValues ...string)

SetEnvVars sets vars on the form key=value in the oldVars slice.

func SplitEnvVar Uses

func SplitEnvVar(v string) (string, string)

type Build Uses

type Build struct {
    UseResourceCacheWhen string // never, fallback, always. Default is fallback
}

Build holds some build related condfiguration.

func DecodeBuild Uses

func DecodeBuild(cfg Provider) Build

func (Build) UseResourceCache Uses

func (b Build) UseResourceCache(err error) bool

type Headers Uses

type Headers struct {
    For    string
    Values map[string]interface{}
}

type Provider Uses

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 Uses

func FromConfigString(config, configType string) (Provider, error)

FromConfigString creates a config from the given YAML, JSON or TOML config. This is useful in tests.

func FromFile Uses

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

FromFile loads the configuration from the given filename.

type Server Uses

type Server struct {
    Headers []Headers
    // contains filtered or unexported fields
}

Config for the dev server.

func DecodeServer Uses

func DecodeServer(cfg Provider) *Server

func (*Server) Match Uses

func (s *Server) Match(pattern string) []types.KeyValueStr

type Sitemap Uses

type Sitemap struct {
    ChangeFreq string
    Priority   float64
    Filename   string
}

Sitemap configures the sitemap to be generated.

func DecodeSitemap Uses

func DecodeSitemap(prototype Sitemap, input map[string]interface{}) Sitemap

Directories

PathSynopsis
privacy
services

Package config imports 17 packages (graph) and is imported by 500 packages. Updated 2020-03-08. Refresh now. Tools for package owners.