Cherry.Theme.Resolver (cherry v0.1.0-rc.1)

Copy Markdown View Source

The three-level template lookup: site overlay → theme → framework.

Three levels, never more (Hugo's specificity matrix is the cautionary tale), and always printable via cherry theme.which. Overlays are keyed per-theme (themes/<theme-name>/templates/…) so swapping themes never silently applies overrides written for a different theme.

Summary

Functions

The full lookup chain for a template: {level, path, exists?} in priority order. The first existing entry wins.

Where a site's overlay file for this theme + template would live.

Resolves a template to the winning {level, path}.

Functions

chain(site, theme, name)

@spec chain(Cherry.Site.t(), Cherry.Theme.t(), atom()) :: [
  {atom(), Path.t(), boolean()}
]

The full lookup chain for a template: {level, path, exists?} in priority order. The first existing entry wins.

overlay_path(site, theme, name)

@spec overlay_path(Cherry.Site.t(), Cherry.Theme.t(), atom()) :: Path.t()

Where a site's overlay file for this theme + template would live.

resolve(site, theme, name)

@spec resolve(Cherry.Site.t(), Cherry.Theme.t(), atom()) ::
  {:ok, {atom(), Path.t()}} | {:error, String.t()}

Resolves a template to the winning {level, path}.