config

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2017 License: MIT Imports: 5 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:"-"`

	// 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

	// Plugins
	ExcerptSeparator string `yaml:"excerpt_separator"`

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

	// Outputting
	Permalink string

	Defaults []struct {
		Scope struct {
			Path string
			Type string
		}
		Values map[string]interface{}
	}

	Variables map[string]interface{} `yaml:"-"`
}

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(flags Flags)

ApplyFlags overwrites the configuration with values from flags.

func (*Config) GetFrontMatterDefaults

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

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

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) 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; exception are *.md -> *.html, and *.{sass,scss} -> *.css.

func (*Config) SourceDir

func (c *Config) SourceDir() string

SourceDir returns the source directory as an absolute path.

type Flags

type Flags struct {
	Destination, Host           *string
	Drafts, Future, Unpublished *bool
	Port                        *int
}

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