You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A few sources have told me that Mojolicious supports nested layouts, but these don't appear to work. The log indeed reports loading both templates, however the result only renders the topmost template.
If I'm doing something wrong here any pointers would be helpful.
Steps to reproduce the behavior
$ mojo generate lite-app nesting.pl
...
$ cat nesting.pl
#!/usr/bin/env perluse Mojolicious::Lite -signatures;
get '/'=>sub ($c) {
$c->render(template=>'index');
};
app->start;
__DATA__@@ index.html.ep% layout 'main';% title 'Welcome';<h1>Welcome to the Mojolicious real-time web framework!</h1>@@ layouts/default.html.ep<!DOCTYPE html><html> <head><title><%= title %></title></head> <body><%= content %></body></html>@@ layouts/main.html.ep% layout 'default';<main><%= content %></main><footer>This content is the footer.</footer>$ morbo nesting.pl
Expected behavior
$ curl 127.0.0.1:3000
<!DOCTYPE html>
<html>
<head><title>Welcome</title></head>
<main>
<body><h1>Welcome to the Mojolicious real-time web framework!</h1>
</main>
<footer>
This is the footer content.
</footer>
</body>
</html>
Actual behavior
$ curl 127.0.0.1:3000
<!DOCTYPE html>
<html>
<head><title>Welcome</title></head>
<body><h1>Welcome to the Mojolicious real-time web framework!</h1>
</body>
</html>
The text was updated successfully, but these errors were encountered:
A few sources have told me that Mojolicious supports nested layouts, but these don't appear to work. The log indeed reports loading both templates, however the result only renders the topmost template.
If I'm doing something wrong here any pointers would be helpful.
Steps to reproduce the behavior
Expected behavior
Actual behavior
The text was updated successfully, but these errors were encountered: