Documentation
¶
Index ¶
- func ApplyDefaults(cfg *Config)
- func DetectConfigFile(dir string) (string, error)
- func MergeFlags(cfg *Config, flags map[string]interface{})
- func Validate(cfg *Config) error
- type BuildConfig
- type CollectionConfig
- type Config
- type ContentConfig
- type DataConfig
- type GoldmarkConfig
- type LanguageConfig
- type MarkdownConfig
- type PaginationConfig
- type PassthroughMapping
- type PluginsConfig
- type SSRConfig
- type SitemapConfig
- type SourceConfig
- type StructureConfig
- type TaxonomyConfig
- type TemplatesConfig
- type WatchMapping
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyDefaults ¶
func ApplyDefaults(cfg *Config)
ApplyDefaults sets default values on a Config struct. Exported so that callers (e.g. pipeline.Build) that receive a Config without going through LoadWithDefaults can still apply canonical defaults.
func DetectConfigFile ¶
DetectConfigFile finds the config file in the given directory.
func MergeFlags ¶
MergeFlags merges CLI flag values into a loaded config. Flag values override config file values. Flags not present in the map leave config values unchanged.
Types ¶
type BuildConfig ¶
type BuildConfig struct {
Output string `yaml:"output" toml:"output" json:"output"`
Clean *bool `yaml:"clean" toml:"clean" json:"clean"`
}
BuildConfig holds output directory and clean settings.
func (*BuildConfig) CleanValue ¶
func (b *BuildConfig) CleanValue() bool
CleanValue returns the effective Clean setting. nil (omitted) defaults to true; only explicit false disables.
type CollectionConfig ¶
type CollectionConfig struct {
SortBy string `yaml:"sortBy" toml:"sortBy" json:"sortBy"`
Order string `yaml:"order" toml:"order" json:"order"`
}
CollectionConfig holds per-collection sort settings.
type Config ¶
type Config struct {
ProjectRoot string `yaml:"-" toml:"-" json:"-"` // set by Load; directory containing the config file
Title string `yaml:"title" toml:"title" json:"title"`
BaseURL string `yaml:"baseURL" toml:"baseURL" json:"baseURL"`
Language string `yaml:"language" toml:"language" json:"language"`
Verbose bool `yaml:"-" toml:"-" json:"-"` // CLI-only, set via MergeFlags
Quiet bool `yaml:"-" toml:"-" json:"-"` // CLI-only, set via MergeFlags
Refetch bool `yaml:"-" toml:"-" json:"-"` // CLI-only: --refetch bypasses fetch cache
IncludeDrafts bool `yaml:"-" toml:"-" json:"-"` // CLI-only: dev server includes drafts
Data DataConfig `yaml:"data" toml:"data" json:"data"`
Build BuildConfig `yaml:"build" toml:"build" json:"build"`
Content ContentConfig `yaml:"content" toml:"content" json:"content"`
Templates TemplatesConfig `yaml:"templates" toml:"templates" json:"templates"`
Plugins PluginsConfig `yaml:"plugins" toml:"plugins" json:"plugins"`
Taxonomies map[string]*TaxonomyConfig `yaml:"taxonomies" toml:"taxonomies" json:"taxonomies"`
Pagination PaginationConfig `yaml:"pagination" toml:"pagination" json:"pagination"`
Passthrough []PassthroughMapping `yaml:"passthrough" toml:"passthrough" json:"passthrough"`
Watch []WatchMapping `yaml:"watch" toml:"watch" json:"watch"`
Sources map[string]*SourceConfig `yaml:"sources" toml:"sources" json:"sources"`
Sitemap SitemapConfig `yaml:"sitemap" toml:"sitemap" json:"sitemap"`
Structure StructureConfig `yaml:"structure" toml:"structure" json:"structure"`
Languages map[string]*LanguageConfig `yaml:"languages" toml:"languages" json:"languages"`
Collections map[string]*CollectionConfig `yaml:"collections" toml:"collections" json:"collections"`
SSR *SSRConfig `yaml:"ssr" toml:"ssr" json:"ssr"`
UpdateCheck *bool `yaml:"updateCheck" toml:"updateCheck" json:"updateCheck"`
}
Config represents the full alloy.config.yaml structure.
func LoadWithDefaults ¶
LoadWithDefaults loads a config file and applies default values.
func (*Config) UpdateCheckValue ¶ added in v0.5.0
UpdateCheckValue returns the effective UpdateCheck setting. nil (omitted) defaults to false — no outbound network request without explicit opt-in. Only explicit true enables update checking. This is the inverse of other *bool config fields (which default to true).
type ContentConfig ¶
type ContentConfig struct {
Formats []string `yaml:"formats" toml:"formats" json:"formats"`
Markdown MarkdownConfig `yaml:"markdown" toml:"markdown" json:"markdown"`
}
ContentConfig holds content format and Markdown settings.
type DataConfig ¶
DataConfig holds external data file mappings. Files maps a data key to a file path relative to the project root.
type GoldmarkConfig ¶
type GoldmarkConfig struct {
Unsafe *bool `yaml:"unsafe" toml:"unsafe" json:"unsafe"`
Typographer bool `yaml:"typographer" toml:"typographer" json:"typographer"`
TemplateTags *bool `yaml:"templateTags" toml:"templateTags" json:"templateTags"`
AutoHeadingID *bool `yaml:"autoHeadingID" toml:"autoHeadingID" json:"autoHeadingID"`
CustomElements *bool `yaml:"customElements" toml:"customElements" json:"customElements"`
}
GoldmarkConfig holds goldmark-specific options. Boolean fields that default to true use *bool so ApplyDefaults can distinguish "not set" (nil → true) from "explicitly false".
func (*GoldmarkConfig) AutoHeadingIDValue ¶
func (g *GoldmarkConfig) AutoHeadingIDValue() bool
AutoHeadingIDValue returns the effective AutoHeadingID setting. nil (omitted) defaults to true; only explicit false disables.
func (*GoldmarkConfig) CustomElementsValue ¶ added in v0.3.0
func (g *GoldmarkConfig) CustomElementsValue() bool
CustomElementsValue returns the effective CustomElements setting. nil (omitted) defaults to true; only explicit false disables.
func (*GoldmarkConfig) TemplateTagsValue ¶
func (g *GoldmarkConfig) TemplateTagsValue() bool
TemplateTagsValue returns the effective TemplateTags setting. nil (omitted) defaults to true; only explicit false disables.
func (*GoldmarkConfig) UnsafeValue ¶
func (g *GoldmarkConfig) UnsafeValue() bool
UnsafeValue returns the effective Unsafe setting. nil (omitted) defaults to true; only explicit false disables.
type LanguageConfig ¶
type LanguageConfig struct {
Title string `yaml:"title" toml:"title" json:"title"`
Weight int `yaml:"weight" toml:"weight" json:"weight"`
Root bool `yaml:"root" toml:"root" json:"root"`
Strings map[string]string `yaml:"strings" toml:"strings" json:"strings"`
}
LanguageConfig holds per-language settings for i18n.
type MarkdownConfig ¶
type MarkdownConfig struct {
TOC *bool `yaml:"toc" toml:"toc" json:"toc"`
Goldmark GoldmarkConfig `yaml:"goldmark" toml:"goldmark" json:"goldmark"`
}
MarkdownConfig holds goldmark options and Alloy-level markdown settings. TOC uses *bool so ApplyDefaults can distinguish "not set" (nil → true) from "explicitly false".
func (*MarkdownConfig) TOCValue ¶ added in v0.4.0
func (m *MarkdownConfig) TOCValue() bool
TOCValue returns the effective TOC setting. nil (omitted) defaults to true; only explicit false disables.
type PaginationConfig ¶
type PaginationConfig struct {
Path string `yaml:"path" toml:"path" json:"path"`
}
PaginationConfig holds pagination path settings.
type PassthroughMapping ¶
type PassthroughMapping struct {
From string `yaml:"from" toml:"from" json:"from"`
To string `yaml:"to" toml:"to" json:"to"`
Exclude []string `yaml:"exclude" toml:"exclude" json:"exclude"`
}
PassthroughMapping maps an external path (directory, file, or glob pattern) to an output path.
type PluginsConfig ¶
type PluginsConfig struct {
Node bool `yaml:"node" toml:"node" json:"node"`
Timeout int `yaml:"timeout" toml:"timeout" json:"timeout"`
Workers interface{} `yaml:"workers" toml:"workers" json:"workers"` // "auto" (default) or int
}
PluginsConfig holds plugin system settings.
type SSRConfig ¶
type SSRConfig struct {
Command string `yaml:"command" toml:"command" json:"command"`
Mode string `yaml:"mode" toml:"mode" json:"mode"`
Timeout string `yaml:"timeout" toml:"timeout" json:"timeout"`
}
SSRConfig holds SSR engine settings.
type SitemapConfig ¶
type SitemapConfig struct {
Enabled bool `yaml:"-" toml:"-" json:"-"`
ChangeFreq string `yaml:"changefreq" toml:"changefreq" json:"changefreq"`
Priority float64 `yaml:"priority" toml:"priority" json:"priority"`
// contains filtered or unexported fields
}
SitemapConfig holds sitemap generation settings.
func (*SitemapConfig) UnmarshalYAML ¶ added in v0.4.0
func (s *SitemapConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML accepts both `sitemap: false` (boolean) and `sitemap: {changefreq: ..., priority: ...}` (object) forms.
type SourceConfig ¶
type SourceConfig struct {
Type string `yaml:"type" toml:"type" json:"type"`
URL string `yaml:"url" toml:"url" json:"url"`
Endpoint string `yaml:"endpoint" toml:"endpoint" json:"endpoint"`
Query string `yaml:"query" toml:"query" json:"query"`
Plugin string `yaml:"plugin" toml:"plugin" json:"plugin"`
Cache int `yaml:"cache" toml:"cache" json:"cache"`
As string `yaml:"as" toml:"as" json:"as"`
}
SourceConfig holds external data source settings.
type StructureConfig ¶
type StructureConfig struct {
Content string `yaml:"content" toml:"content" json:"content"` // default: "content"
Layouts string `yaml:"layouts" toml:"layouts" json:"layouts"` // default: "layouts"
Assets string `yaml:"assets" toml:"assets" json:"assets"` // default: "assets"
Static string `yaml:"static" toml:"static" json:"static"` // default: "static"
Data string `yaml:"data" toml:"data" json:"data"` // default: "data"
Plugins string `yaml:"plugins" toml:"plugins" json:"plugins"` // default: "plugins"
Components string `yaml:"components" toml:"components" json:"components"` // default: "components"
}
StructureConfig holds custom directory paths for project structure. All paths are relative to project root. When not specified, defaults apply.
type TaxonomyConfig ¶
type TaxonomyConfig struct {
Permalink string `yaml:"permalink" toml:"permalink" json:"permalink"`
Layout string `yaml:"layout" toml:"layout" json:"layout"`
Render *bool `yaml:"render" toml:"render" json:"render"`
}
TaxonomyConfig holds per-taxonomy settings.
func (*TaxonomyConfig) ShouldRender ¶
func (tc *TaxonomyConfig) ShouldRender() bool
ShouldRender returns whether taxonomy pages should be generated. nil (omitted) and true both mean render; only explicit false suppresses.
type TemplatesConfig ¶
type TemplatesConfig struct {
Engine string `yaml:"engine" toml:"engine" json:"engine"`
}
TemplatesConfig holds the template engine selection.
type WatchMapping ¶
type WatchMapping struct {
From string `yaml:"from" toml:"from" json:"from"`
Type string `yaml:"type" toml:"type" json:"type"`
}
WatchMapping registers an external directory for pipeline-triggering file watching during serve mode.