config

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(bytes []byte, c *Config) error

Unmarshal updates site from a YAML configuration file.

Types

type Config

type Config struct {
	// Where things are:
	Source      string
	Destination string
	LayoutsDir  string                            `yaml:"layouts_dir"`
	DataDir     string                            `yaml:"data_dir"`
	IncludesDir string                            `yaml:"includes_dir"`
	Collections map[string]map[string]interface{} `yaml:"-"`
	Theme       string

	// Handling Reading
	Include     []string
	Exclude     []string
	KeepFiles   []string `yaml:"keep_files"`
	MarkdownExt string   `yaml:"markdown_ext"`

	// Filtering Content
	Drafts      bool `yaml:"show_drafts"`
	Future      bool
	Unpublished bool

	// Plugins
	Plugins []string

	// Conversion
	ExcerptSeparator string `yaml:"excerpt_separator"`
	Incremental      bool
	Sass             struct {
		Dir string `yaml:"sass_dir"`
	}

	// Serving
	Host        string
	Port        int
	AbsoluteURL string `yaml:"url"`
	BaseURL     string

	// Outputting
	Permalink string
	Timezone  string
	Verbose   bool
	Defaults  []struct {
		Scope struct {
			Path string
			Type string
		}
		Values map[string]interface{}
	}

	// CLI-only
	DryRun       bool `yaml:"-"`
	ForcePolling bool `yaml:"-"`
	Watch        bool `yaml:"-"`

	// Meta
	ConfigFile string `yaml:"-"`

	// Plugins
	RequireFrontMatter        bool            `yaml:"-"`
	RequireFrontMatterExclude map[string]bool `yaml:"-"`
	// contains filtered or unexported fields
}

Config is the Jekyll site configuration, typically read from _config.yml. See https://jekyllrb.com/docs/configuration/#default-configuration

func Default

func Default() Config

Default returns a default site configuration.

This is a function instead of a global variable, and returns a new value each time, since the caller may overwrite it.

func FromString

func FromString(src string) Config

FromString returns a new configuration initialized from a string

func (*Config) ApplyFlags

func (c *Config) ApplyFlags(f Flags)

ApplyFlags overwrites the configuration with values from flags.

func (*Config) FromDirectory added in v0.2.0

func (c *Config) FromDirectory(dir string) error

FromDirectory updates the config from the config file in the directory, if such a file exists.

func (*Config) GetFrontMatterDefaults

func (c *Config) GetFrontMatterDefaults(typename, rel string) (m map[string]interface{})

GetFrontMatterDefaults implements https://jekyllrb.com/docs/configuration/#front-matter-defaults

func (*Config) IsConfigPath added in v0.2.0

func (c *Config) IsConfigPath(rel string) bool

IsConfigPath returns true if its arguments is a site configuration file.

func (*Config) IsMarkdown

func (c *Config) IsMarkdown(name string) bool

IsMarkdown returns a boolean indicating whether the file is a Markdown file, according to the current project.

func (*Config) IsSASSPath

func (c *Config) IsSASSPath(name string) bool

IsSASSPath returns a boolean indicating whether the file is a Sass (".sass" or ".scss") file.

func (*Config) Map added in v0.2.7

func (c *Config) Map(key string) (map[string]interface{}, bool)

Map returns the config indexed by key, if it's a map.

func (*Config) MarkdownExtensions

func (c *Config) MarkdownExtensions() []string

MarkdownExtensions returns a list of markdown extensions, with dotsa.

func (*Config) OutputExt

func (c *Config) OutputExt(pathname string) string

OutputExt returns the pathname's output extension. This is generally the pathname extension; exceptions are *.md -> *.html, and *.{sass,scss} -> *.css.

func (*Config) RequiresFrontMatter added in v0.2.0

func (c *Config) RequiresFrontMatter(rel string) bool

RequiresFrontMatter returns a bool indicating whether the file requires front matter in order to recognize as a page.

func (*Config) SassDir added in v0.2.0

func (c *Config) SassDir() string

SassDir returns the relative path of the SASS directory.

func (*Config) Set added in v0.2.7

func (c *Config) Set(key string, val interface{})

Set sets a value in the Liquid variable map. This does not update the corresponding value in the Config struct.

func (*Config) SourceDir

func (c *Config) SourceDir() string

SourceDir returns the source directory as an absolute path.

func (*Config) String added in v0.2.7

func (c *Config) String(key string) (string, bool)

String returns the config indexed by key, if it's a string.

func (*Config) Variables

func (c *Config) Variables() map[string]interface{}

Variables returns the configuration as a Liquid variable map.

type Flags

type Flags struct {
	// these are pointers so we can tell whether they've been set, and leave
	// the config file alone if not
	Destination, Host           *string
	Drafts, Future, Unpublished *bool
	Incremental, Verbose        *bool
	Port                        *int

	// these aren't in the config file, so make them actual values
	DryRun, ForcePolling, Watch bool
}

Flags are applied after the configuration file is loaded. They are pointers to represent optional types, to tell whether they have been set.

Jump to

Keyboard shortcuts

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