config

package
v0.0.0-...-ab591ec Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Shizuka ConfigShizuka `toml:"shizuka" yaml:"shizuka" json:"shizuka"`
	Site    ConfigSite    `toml:"site" yaml:"site" json:"site"`
	Build   ConfigBuild   `toml:"build" yaml:"build" json:"build"`
}

Config represents the configuration for the build process.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig constructs a new Config with default values.

func Load

func Load(path string) (*Config, error)

Load loads a Config from a file.

func LoadFS

func LoadFS(fsys fs.FS, path string) (*Config, error)

LoadFS loads a Config from a file within the provided fs.FS.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the Config.

func (*Config) WatchedPaths

func (c *Config) WatchedPaths() (paths []string, globs []string)

type ConfigBuild

type ConfigBuild struct {
	Output string `toml:"output" yaml:"output" json:"output"`
	Minify bool   `toml:"minify" yaml:"minify" json:"minify"`

	Steps ConfigBuildSteps `toml:"steps" yaml:"steps" json:"steps"`
}

type ConfigBuildSteps

type ConfigBuildSteps struct {
	Static    *ConfigStepStatic    `toml:"static" yaml:"static" json:"static"`
	Content   *ConfigStepContent   `toml:"content" yaml:"content" json:"content"`
	Headers   *ConfigStepHeaders   `toml:"headers" yaml:"headers" json:"headers"`
	Redirects *ConfigStepRedirects `toml:"redirects" yaml:"redirects" json:"redirects"`
	RSS       *ConfigStepRSS       `toml:"rss" yaml:"rss" json:"rss"`
	Sitemap   *ConfigStepSitemap   `toml:"sitemap" yaml:"sitemap" json:"sitemap"`
}

type ConfigGoldmark

type ConfigGoldmark struct {
	Extensions []string               `toml:"extensions" yaml:"extensions" json:"extensions"`
	Parser     ConfigGoldmarkParser   `toml:"parser" yaml:"parser" json:"parser"`
	Renderer   ConfigGoldmarkRenderer `toml:"renderer" yaml:"renderer" json:"renderer"`
}

func (ConfigGoldmark) Build

func (cfg ConfigGoldmark) Build() gm.Markdown

type ConfigGoldmarkParser

type ConfigGoldmarkParser struct {
	AutoHeadingID bool `toml:"auto_heading_id" yaml:"auto_heading_id" json:"auto_heading_id"`
	Attribute     bool `toml:"attribute" yaml:"attribute" json:"attribute"`
}

type ConfigGoldmarkRenderer

type ConfigGoldmarkRenderer struct {
	Hardbreaks bool `toml:"hardbreaks" yaml:"hardbreaks" json:"hardbreaks"`
	XHTML      bool `toml:"XHTML" yaml:"XHTML" json:"XHTML"`
}

type ConfigShizuka

type ConfigShizuka struct {
	Version string `toml:"version" yaml:"version" json:"version"`
}

type ConfigSite

type ConfigSite struct {
	Title       string `toml:"title" yaml:"title" json:"title"`
	Description string `toml:"description" yaml:"description" json:"description"`
	URL         string `toml:"url" yaml:"url" json:"url"`

	Params map[string]any `toml:"params" yaml:"params" json:"params"`
}

type ConfigStepContent

type ConfigStepContent struct {
	TemplateGlob   string         `toml:"template_glob" yaml:"template_glob" json:"template_glob"`
	Source         string         `toml:"source" yaml:"source" json:"source"`
	Destination    string         `toml:"destination" yaml:"destination" json:"destination"`
	DefaultParams  map[string]any `toml:"default_params" yaml:"default_params" json:"default_params"`
	Cascade        map[string]any `toml:"cascade" yaml:"cascade" json:"cascade"`
	GoldmarkConfig ConfigGoldmark `toml:"goldmark_config" yaml:"goldmark_config" json:"goldmark_config"`
}

type ConfigStepHeaders

type ConfigStepHeaders struct {
	Headers map[string]map[string]string `toml:"headers" yaml:"headers" json:"headers"`
	Output  string                       `toml:"output" yaml:"output" json:"output"`
}

type ConfigStepRSS

type ConfigStepRSS struct {
	Output        string   `toml:"output" yaml:"output" json:"output"`
	Sections      []string `toml:"sections" yaml:"sections" json:"sections"`
	Limit         int      `toml:"limit" yaml:"limit" json:"limit"`
	IncludeDrafts bool     `toml:"include_drafts" yaml:"include_drafts" json:"include_drafts"`
}

type ConfigStepRedirects

type ConfigStepRedirects struct {
	Shorten   string     `toml:"shorten" yaml:"shorten" json:"shorten"`
	Redirects []Redirect `toml:"redirects" yaml:"redirects" json:"redirects"`
	Output    string     `toml:"output" yaml:"output" json:"output"`
}

type ConfigStepSitemap

type ConfigStepSitemap struct {
	Output        string `toml:"output" yaml:"output" json:"output"`
	IncludeDrafts bool   `toml:"include_drafts" yaml:"include_drafts" json:"include_drafts"`
}

type ConfigStepStatic

type ConfigStepStatic struct {
	Source      string `toml:"source" yaml:"source" json:"source"`
	Destination string `toml:"destination" yaml:"destination" json:"destination"`
}

type Options

type Options struct {
	Context    context.Context
	ConfigPath string
	OutputPath string
	SiteURL    string

	MaxWorkers int
	Dev        bool

	Source      iofs.Readable
	Destination iofs.Writable

	PageErrTemplates map[error]*template.Template
	ErrTemplate      *template.Template
	EventHandler     events.Handler
}

Options represents the options for building a site.

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions constructs an Options with default values.

func (*Options) WithConfig

func (o *Options) WithConfig(path string) *Options

WithConfig sets the path to the configuration file

func (*Options) WithContext

func (o *Options) WithContext(ctx context.Context) *Options

WithContext sets the root context for building

func (*Options) WithDestination

func (o *Options) WithDestination(dest iofs.Writable) *Options

WithDestination sets the output destination for building.

func (*Options) WithDestinationPath

func (o *Options) WithDestinationPath(path string) *Options

WithDestinationPath sets the output destination using an OS path.

func (*Options) WithDev

func (o *Options) WithDev() *Options

WithDev enables development mode

func (*Options) WithErrTemplate

func (o *Options) WithErrTemplate(tmpl *template.Template) *Options

WithErrTemplate sets the error template for building

func (*Options) WithEventHandler

func (o *Options) WithEventHandler(handler events.Handler) *Options

WithEventHandler sets the event handler for building

func (*Options) WithMaxWorkers

func (o *Options) WithMaxWorkers(n int) *Options

WithMaxWorkers sets the maximum number of workers to use for building

func (*Options) WithOutput

func (o *Options) WithOutput(path string) *Options

WithOutput sets the path to the output directory, overriding config

func (*Options) WithPageErrorTemplates

func (o *Options) WithPageErrorTemplates(pages map[error]*template.Template) *Options

WithPageErrorTemplates sets the page error templates for building, nil corresponds to a catch-all template

func (*Options) WithSiteURL

func (o *Options) WithSiteURL(url string) *Options

WithSiteURL sets the site base URL, overriding config.

func (*Options) WithSource

func (o *Options) WithSource(source iofs.Readable) *Options

WithSource sets the input source for building.

func (*Options) WithSourcePath

func (o *Options) WithSourcePath(path string) *Options

WithSourcePath sets the input source using an OS path.

type Redirect

type Redirect struct {
	From   string `toml:"from" yaml:"from" json:"from"`
	To     string `toml:"to" yaml:"to" json:"to"`
	Status int    `toml:"status" yaml:"status" json:"status"`
}

Jump to

Keyboard shortcuts

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