Cherry.Theme.Renderer (cherry v0.1.0-rc.3)

Copy Markdown View Source

Renders theme templates: runtime-evaluated EEx, so themes work identically in project mode and binary mode (ADR 0002/0004).

Summary

Functions

Renders a named template through the lookup chain with the given assigns.

Renders a content template and wraps it in the theme's layout.

Functions

render(site, theme, name, assigns)

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

Renders a named template through the lookup chain with the given assigns.

render_in_layout(context, name, assigns)

@spec render_in_layout(Cherry.Theme.RenderContext.t(), atom(), keyword()) ::
  {:ok, String.t()} | {:error, String.t()}

Renders a content template and wraps it in the theme's layout.

The context carries the layout's own assigns: page title, the framework-owned SEO head block (Cherry.SEO.Head, interpolated verbatim inside <head>), and the navigation.