Module

core.site.properties

Site properties mixin.

Provides property accessors for site configuration values (title, baseurl, author) and computed properties like theme_config and indexes.

Related Modules:

  • bengal.core.site.core: Main Site dataclass using this mixin
  • bengal.core.theme: Theme configuration
  • bengal.cache.query_index_registry: Query indexes

Classes

SitePropertiesMixin
Mixin providing property accessors for site configuration. Requires these attributes on the host c…
7

Mixin providing property accessors for site configuration.

Requires these attributes on the host class:

  • config: dict[str, Any]
  • root_path: Path
  • _theme_obj: Theme | None
  • _config_hash: str | None
  • _query_registry: Any

Attributes

Name Type Description
config dict[str, Any]
root_path Path
_theme_obj Theme | None
_config_hash str | None
_query_registry Any

Methods 6

title property
Get site title from configuration.
str | None
def title(self) -> str | None

Get site title from configuration.

Returns

str | None

Site title string from config, or None if not configured

baseurl property
Get site baseurl from configuration. Baseurl is prepended to all page URLs. Ca…
str | None
def baseurl(self) -> str | None

Get site baseurl from configuration.

Baseurl is prepended to all page URLs. Can be empty, path-only (e.g., "/blog"), or absolute (e.g., "https://example.com").

Returns

str | None

Base URL string from config, or None if not configured

author property
Get site author from configuration.
str | None
def author(self) -> str | None

Get site author from configuration.

Returns

str | None

Author name string from config, or None if not configured

config_hash property
Get deterministic hash of the resolved configuration. Used for automatic cache…
str
def config_hash(self) -> str

Get deterministic hash of the resolved configuration.

Used for automatic cache invalidation when configuration changes.

The hash captures the effective config state including:

  • Base config from files
  • Environment variable overrides
  • Build profile settings
Returns

str

16-character hex string (truncated SHA-256)

theme_config property
Get theme configuration object. Available in templates as `site.theme_config` …
Theme
def theme_config(self) -> Theme

Get theme configuration object.

Available in templates assite.theme_configfor accessing theme settings:

  • site.theme_config.name: Theme name
  • site.theme_config.default_appearance: Default light/dark/system mode
  • site.theme_config.default_palette: Default color palette
  • site.theme_config.config: Additional theme-specific config
Returns

Theme

Theme configuration object

indexes property
Access to query indexes for O(1) page lookups. Provides pre-computed indexes f…
QueryIndexRegistry
def indexes(self) -> QueryIndexRegistry

Access to query indexes for O(1) page lookups.

Provides pre-computed indexes for common page queries: site.indexes.section.get('blog') # All blog posts site.indexes.author.get('Jane Smith') # Posts by Jane site.indexes.category.get('tutorial') # Tutorial pages site.indexes.date_range.get('2024') # 2024 posts

Indexes are built during the build phase and provide O(1) lookups instead of O(n) filtering. This makes templates scale to large sites.

Returns

QueryIndexRegistry

QueryIndexRegistry instance

Internal Methods 1
_compute_config_hash
Compute and cache the configuration hash. Calculates SHA-256 hash of resolved …
0 None
def _compute_config_hash(self) -> None

Compute and cache the configuration hash.

Calculates SHA-256 hash of resolved configuration (including env overrides and build profiles) and stores it in_config_hash. Used for automatic cache invalidation when configuration changes.

Called during post_init to ensure hash is available immediately. Subsequent calls use cached value unless config changes.