Skip to main content

render

Function render 

Source
pub async fn render(
    t: &Tenant,
    tera: &Tera,
    page: &Page,
    url_prefix: &str,
    site_prefix: &str,
    locale_code: Option<&str>,
    viewer: Option<&User>,
    cache: Option<(&BoxedCache, Duration)>,
) -> Response
Expand description

Render page to an HTTP response. On any failure (missing page-type row, missing handler, template error) returns a 500/404 response with a short diagnostic body.

url_prefix is the mount prefix the public CMS is served under (e.g. "" for root, "/p" for router_at("/p", _)). It is injected into the Tera context as url_prefix, but prefer the page_href helper for links — {{ child | page_href }} / {{ page_href(page=ancestor) }} — which prepends the prefix to the page’s full url_path. Do NOT build links as {{ url_prefix }}/{{ ancestor.slug }} — the leaf slug alone breaks for any page deeper than one level (a grandchild /a/b → /b).