Functions
render_with_layouts
6
str
▼
Render page content wrapped in its layout chain.
Uses ``HX-Target`` to determi…
render_with_layouts
6
str
▼
def render_with_layouts(env: Environment, *, layout_chain: LayoutChain, page_html: str, context: dict[str, Any], htmx_target: str | None = None, is_history_restore: bool = False) -> str
Render page content wrapped in its layout chain.
UsesHX-Targetto determine rendering depth:
- No target (full page load or history restore): render all layouts nested, innermost first.
- Target matches a layout: skip layouts at or above the matched one; render from the next layout down.
- Target matches no layout: return page HTML as-is (fragment).
Parameters
| Name | Type | Description |
|---|---|---|
env |
Environment |
The kida |
layout_chain |
LayoutChain |
Sequence of layouts from root (outermost) to deepest (closest to the page). |
page_html |
str |
Pre-rendered page content HTML. |
context |
dict[str, Any] |
Merged context variables for layout templates. |
htmx_target |
str | None |
Value of None
|
is_history_restore |
bool |
Whether this is an htmx history restore. Default:False
|
Returns
str