Render a view with a layout
$.view(name, model) renders views/<name>.html and wraps it in views/layout.html. Inside a view the data is available as model; use @{...} for expressions, @{foreach ... in ...} to loop and @{body} in the layout to place the view.
The layout is rendered without the model. To give it values (a page title, for example) use repository: the object returned by $.view() exposes it.
<!DOCTYPE html>
<html>
<head><title>@{repository.title}</title></head>
<body>
@{body}
</body>
</html><h1>@{model.name}</h1>
<ul>
@{foreach item in model.items}
<li>@{item}</li>
@{end}
</ul>exports.install = function() {
ROUTE('GET /', home);
};
function home($) {
var view = $.view('index', { name: 'Forge', items: ['routes', 'actions'] });
view.repository.title = 'Home';
}