#config

    Site configuration: defaults, theme merge, and the derived paths every other package asks for.

    Import as justjavac/fus/config.

    • resolve_config_path(root, override?) finds fus.config.{yaml,yml,toml,json,ini} in the root unless --config names one.
    • load_config(root, config?, dest?, drafts) parses it, merges the theme's theme.yaml underneath the site's own keys, and returns a Config. load_config_with accepts custom format and content registries.
    • Config carries the resolved source, dest, output_dir, layouts_dir, includes_dir, data_dir, static_dir, theme, languages, plugins, permalink and paginate_size, plus site_data (the site: block), globals and the raw merged tree.
    • Helpers: source_path, output_path, cache_path, theme_path, is_multilingual, has_lang, lang_prefix, lang_name, is_ignored.

    Missing keys fall back to defaults; a file that fails to parse prints a warning instead of aborting, so check can report the real problem.

    Config

    pub struct Config {
    root : String
    source : String
    dest : String
    layouts_dir : String
    includes_dir : String
    data_dir : String
    static_dir : String
    output_dir : String
    ignore : Array[String]
    page_exts : Array[String]
    engine :
    EngineKind

    permalink : String
    default_layout : String
    paginate_size : Int
    plugins : Array[String]
    default_lang : String
    languages : Array[Lang]
    base_path : String
    theme : String
    theme_name : String
    site_data :
    Json

    globals :
    Json

    raw :
    Json

    }

    Normalized site configuration.

    Created by load_config from fus.config.yaml with command-line overrides. Fields cover content locations (source, dest, static_dir), template locations (layouts_dir, includes_dir, data_dir), URL rules (permalink, paginate_size), and extension points (plugins, ignore, page_exts). site_data and globals are exposed to templates as site and config.

    Config::cache_path

    fn Config::cache_path(self : Config) -> String

    Path to the incremental cache manifest inside the site root.

    Config::has_lang

    fn Config::has_lang(self : Config, code : StringView) -> Bool

    Whether code is a configured language.

    Config::is_ignored

    fn Config::is_ignored(self : Config, relative : StringView) -> Bool

    Whether a relative path matches any configured ignore prefix.

    Config::is_multilingual

    fn Config::is_multilingual(self : Config) -> Bool

    Whether the site declares more than one language.

    Config::lang_name

    fn Config::lang_name(self : Config, code : StringView) -> String

    How a language is labelled in a switcher, or the uppercase code.

    Config::lang_prefix

    fn Config::lang_prefix(self : Config, code : StringView) -> String

    The URL prefix of a language, empty for the default one.

    Config::output_path

    fn Config::output_path(self : Config) -> String

    Absolute or root-relative path to the generated site directory.

    Config::source_path

    fn Config::source_path(self : Config) -> String

    Absolute or root-relative path to the content source directory.

    Config::theme_path

    fn Config::theme_path(self : Config) -> String

    Path to the configured theme directory, or an empty string when no theme is used. The site root is always searched after the theme, so site files win.

    Lang

    pub struct Lang {
    code : String
    name : String
    }

    One selectable language of a multi-language site.

    code is the directory name under the content root and the URL prefix; name is how a language switcher labels it.

    load_config

    async fn load_config(root : String, config_path : String?, dest_override : String?, force : Bool) -> Config

    Load and normalize a site configuration with the built-in registries.

    root is the site directory. config_path overrides the default file, dest_override overrides the configured output directory and force disables reading the cache manifest. Formats follow the file extension.

    load_config_with

    async fn load_config_with(root : String, config_path : String?, dest_override : String?, force : Bool, formats :
    FormatRegistry
    , contents :
    ContentRegistry
    ) -> Config

    Load configuration with explicit registries.

    Use this to add data formats or page formats: the configuration file is parsed by formats, and the default pageExtensions come from contents.

    resolve_config_path

    async fn resolve_config_path(root : String, config_path : String?) -> String

    Path of the configuration file a build would read.

    config_path wins when given. Otherwise the first existing file of fus.config.yaml, .yml, .json, .toml, .ini is used, and finally the YAML path so that callers always have something to create or report.

    Source Files