Template Toolkit layout



examples/dancer/template-layout/config.yml
---
template: "template_toolkit"
layout:   "general.tt"

examples/dancer/template-layout/app.psgi
package App;
use Dancer2;


get '/' => sub {
    return template 'main.tt', {
        title => 'Perl Dancer',
    };
};

App->to_app;

examples/dancer/template-layout/views/main.tt
<h1>[% title %]</h1>

<h2>Hello Dancer</h2>

examples/dancer/template-layout/views/layouts/general.tt
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
  <title>[% title %]</title>
</head>
<body>
From layout
<hr>
[% content %]
<hr>
Welcome to the main layout.
</body>
</html>