Wytch::Site

Holds the configuration and state for a Wytch site.

Description

Holds the configuration and state for a Wytch site.

The Site class is the central configuration point for Wytch. It manages the content directory, site code loading, page class, and the collection of all pages.

Methods

def load!

Loads the site configuration from config.rb in the current directory.

Returns:
(void)

def inflections

Returns:
(Hash) — custom inflections for Zeitwerk autoloading

def content_dir

Returns:
(String) — directory containing content files (default: "content")

def content_dir=(value)

Returns:
(String) — directory containing content files (default: "content")

def site_code_path

Returns:
(String) — directory containing site Ruby code (default: "src")

def site_code_path=(value)

Returns:
(String) — directory containing site Ruby code (default: "src")

def page_class

Returns:
(String) — fully qualified class name for pages (default: "Wytch::Page")

def page_class=(value)

Returns:
(String) — fully qualified class name for pages (default: "Wytch::Page")

def pages

Returns:
(Hash{String => Page}) — all loaded pages, keyed by path

def pages=(value)

Returns:
(Hash{String => Page}) — all loaded pages, keyed by path

def base_url

Returns:
(String, nil) — base URL for the site (used in sitemaps, feeds, etc.)

def base_url=(value)

Sets the attribute base_url

Parameters:
value — the value to set the attribute base_url to.

def inflect(inflections_hash)

Adds custom inflections for Zeitwerk autoloading.

Parameters:
inflections_hash (Hash{String => String}) — mapping of file names to class names
Returns:
(void)

def site_code_loader

Returns the Zeitwerk loader for site code.

The loader is configured to watch the site_code_path directory and supports hot reloading during development.

Returns:
(Zeitwerk::Loader) — the configured loader

def content_loader

Returns the content loader instance.

Returns:
(ContentLoader) — the loader for content files

def load_content

Loads all content files and populates the pages hash.

Returns:
(Hash{String => Page}) — all loaded pages