class

Hwaro::Models::Config

Inherits Reference / Object

Constants

KNOWN_TOP_LEVEL_KEYS = ["title", "description", "base_url", "default_language", "amp", "assets", "auto_includes", "build", "content", "deployment", "doctor", "feeds", "highlight", "image_processing", "languages", "links", "llms", "markdown", "menus", "og", "outputs", "pagination", "permalinks", "plugins", "pwa", "related", "robots", "sass", "search", "series", "serve", "sitemap", "static", "taxonomies"] of ::String

Every top-level key load reads (scalars + load_* section names). Used to warn on unrecognized keys instead of silently ignoring them — a typo'd [markdonw] or titel = otherwise disables a feature with zero feedback. Templates cannot read arbitrary raw config keys (the site/config objects expose structured fields only), so an unknown top-level key is always dead configuration.

Constructors

load(config_path : String = "config.toml", env : String | Nil = nil) : Config
Source

Class methods

validate_base_url!(value : String) : Nil

Load and parse a config.toml into a populated Config.

Raises Hwaro::HwaroError(HWARO_E_CONFIG) directly at the source for file-not-found and TOML parse errors so every caller (build, deploy, doctor, tool, services) gets a classified error with exit code 3 without having to do substring matching on the exception message. File-not-found is classified as HWARO_E_CONFIG rather than HWARO_E_IO because a missing config.toml is a config-level user error, not an arbitrary IO failure. Accepts an absolute http(s)://host[:port][/path] URL or the empty string (which means "no absolute URL is configured"). Raises ArgumentError on anything else so callers can wrap the failure in whichever classified HwaroError code suits their context (HWARO_E_CONFIG for config.toml, HWARO_E_USAGE for CLI flags).

Source

Instance methods

amp=(amp : AmpConfig)
Source
assets
Source
assets=(assets : AssetsConfig)
Source
auto_includes
Source
auto_includes=(auto_includes : AutoIncludesConfig)
Source
base_path

Path component of base_url, used to make root-relative links work when the site is deployed under a subpath (e.g. GitHub/GitLab project pages served at https://user.github.io/repo/). For https://x.com/repo this returns /repo; for a domain-root deployment (https://x.com) or an empty base_url it returns "". Trailing slashes are stripped so callers can build base_path + page.url without producing //.

Source
base_url
Source
base_url=(value : String)

Normalize on assignment: a trailing slash makes {{ base_url }}/path templates (and canonical/og URLs) emit //. Strip it so the build is correct whether the trailing slash came from config.toml or --base-url (previously only doctor --fix normalized this).

Source
base_url_stripped

Cached base_url with trailing slash stripped (avoids repeated rstrip per page)

Source
build
Source
build=(build : BuildConfig)
Source
content_files
Source
content_files=(content_files : ContentFilesConfig)
Source
content_new
Source
content_new=(content_new : ContentNewConfig)
Source
default_language
Source
default_language=(default_language : String)
Source
deployment
Source
deployment=(deployment : DeploymentConfig)
Source
description
Source
description=(description : String)
Source
doctor
Source
doctor=(doctor : DoctorConfig)
Source
feeds
Source
feeds=(feeds : FeedConfig)
Source
highlight
Source
highlight=(highlight : HighlightConfig)
Source
image_processing
Source
image_processing=(image_processing : ImageProcessingConfig)
Source
language(code : String) : LanguageConfig | Nil

Get language config by code, returns nil if not found

Source
languages
Source
languages=(languages : Hash(String, LanguageConfig))
Source
llms
Source
llms=(llms : LlmsConfig)
Source
markdown
Source
markdown=(markdown : MarkdownConfig)
Source
multilingual?

Check if site is multilingual

Source
og=(og : OpenGraphConfig)
Source
outputs
Source
outputs=(outputs : OutputsConfig)
Source
pagination
Source
pagination=(pagination : PaginationConfig)
Source
plugins
Source
plugins=(plugins : PluginConfig)
Source
pwa=(pwa : PwaConfig)
Source
raw=(raw : Hash(String, TOML::Any))
Source
robots
Source
robots=(robots : RobotsConfig)
Source
sass
Source
sass=(sass : SassConfig)
Source
sass_source?(relative_path : String) : Bool

True when built-in Sass compilation is on and relative_path is an SCSS source — such files compile to .css instead of publishing verbatim through the static copy. The extension must be lowercase .scss, matching what the compiler's glob picks up — other casings keep publishing verbatim.

Source
search
Source
search=(search : SearchConfig)
Source
series
Source
series=(series : SeriesConfig)
Source
serve
Source
serve=(serve : ServeConfig)
Source
sitemap
Source
sitemap=(sitemap : SitemapConfig)
Source
sorted_languages

Get sorted languages by weight

Source
static
Source
static=(static : StaticConfig)
Source
taxonomies
Source
taxonomies=(taxonomies : Array(TaxonomyConfig))
Source
title
Source
title=(title : String)
Source
with_base_path(path : String) : String

Prefix a site-internal root-relative path (e.g. /posts/x/) with base_path so generated URLs resolve under a subpath deployment. Absolute http(s):// URLs and paths that are not root-relative are returned unchanged; a no-op when base_path is "" (domain-root deploy). Callers that may hold a path without a leading slash (e.g. some page.url values) should normalize it first — this helper only prefixes values that already start with "/".

Source