I have a standard Perl Dancer app, using Template::Toolkit as rendering engine, with two routes:
get '/' => sub {
template 'index';
};
get '/foo' => sub {
template 'foo';
};
My views/templates/main.tt
contains the line:
<title><%= title %></title>
I want the value of title var be "My Site" on page '/', and "Foo - My Site" on page '/foo'.
I know I can put these values in the controller file, like this:
template 'index', { title => 'My Site' };
but I want to specify them in the corresponding template files, views/index.tt
and views/foo.tt
.
How can I do that?
Thanks.