config

package
v0.0.0-...-82bc1ab Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Dir = "config"

Dir is the relative directory for configuration files

Variables

View Source
var SiteFile = "_site.yaml"

SiteFile is the relative path of the Site configuration

Functions

func Path

func Path(src string) string

Path of the configuration directory

Types

type Category

type Category struct {
	Name string    `yaml:"name"`
	Vars Variables `yaml:"vars"`
}

Category describes a particular group of content

type Section

type Section struct {
	Name       string      `yaml:"name"`
	Templates  Templates   `yaml:"templates"`
	Categories []*Category `yaml:"categories"`
	Vars       Variables   `yaml:"vars"`
}

Section for rendering content

func NewSection

func NewSection() *Section

NewSection creates an empty Section configuration

func (*Section) HasCategory

func (s *Section) HasCategory(name string) bool

HasCategory determines if a Category exists in this Section

type Sections

type Sections map[string]*Section

Sections is a map of Section configurations

type Site

type Site struct {
	Name       string    `yaml:"name"`
	Deployment string    `yaml:"deploy"`
	Vars       Variables `yaml:"vars"`
	Sections   Sections  `yaml:"-"`
	Dir        string    `yaml:"-"`
	// contains filtered or unexported fields
}

Site is the full configuration for the site

func Load

func Load(dir string) (conf Site, err error)

Load parses all of the config directories

func NewSite

func NewSite() Site

NewSite creates an empty Site configuration

func (*Site) Equal

func (s *Site) Equal(other *Site) bool

Equal checks if there are any differences between this Site and another

func (*Site) IsNewer

func (s *Site) IsNewer(other time.Time) bool

IsNewer checks if this Site was modified after a certain time

func (*Site) Update

func (s *Site) Update() (changed bool, err error)

Update rereads the configuration from disk and checks if it has changed, updating if it has

type Templates

type Templates struct {
	Content  string   `yaml:"content"`
	Listings []string `yaml:"listings"`
	Category string   `yaml:"category"`
}

Templates configures the templates used for rendering

type Variables

type Variables struct {
	Map   map[string]string            `yaml:"map"`
	Maps  map[string]map[string]string `yaml:"maps"`
	Lists map[string][]string          `yaml:"lists"`
}

Variables for rendering templates

func NewVariables

func NewVariables() Variables

NewVariables creates an empty Variables structure

Jump to

Keyboard shortcuts

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