I'm trying to make the default "title" variable in stash be set to the English version of the action name. For example:
sub customer_orders {
...
}
Would have:
title => 'Customer Orders',
Available in the stash for the templates to use. Does anyone know how to do this? Thanks!
It looks like $c->action
is available in Mojolicious templates as $action
. So you can just do this:
<title><%= title || action_to_title($action) %>
This way other templates can override the title like so:
% title 'My Override Title'
And you can add the action_to_title
helper to prepare the action for a title if title
is not set.