Skip to main content

register_tera_function

Function register_tera_function 

Source
pub fn register_tera_function(tera: &mut Tera)
Expand description

Register the routable_url(…) Tera function. Two call shapes (extra kwargs are the named captures):

{# by page type + route name (looks up the handler's RouteSpec) #}
{{ routable_url(path=page.url_path, type=page.type_name, route="archive_year", year=2026) }}
{# or reverse a pattern directly #}
{{ routable_url(path=page.url_path, pattern="archive/(?P<year>\d{4})", year=2026) }}

Returns the full URL ({path}/{suffix}), or null when the route / pattern can’t be reversed.