How to use multiple blocks from different files?

I have a layout.jade that looks like this:

 html body block content block footer 

My content.jade as follows:

 extends layout block content #Content Welcome 

My footer.jade as follows:

 extends layout block footer #Footer Impressum 

Now when I launch my app as follows:

 app.get('/', function(req, res) { res.render('layout'); }); 

I see neither the content nor the footer.

When I run:

 app.get('/', function(req, res) { res.render('content'); }); 

Then I see the contents.

When I run:

 app.get('/', function(req, res) { res.render('footer'); }); 

Then I see the footer.

How can I see both the content and the footer?

+7
source share
1 answer

You probably want something like this:

layout.jade

 html body block content include footer 

pagename.jade

 extends layout block content h1 My Content 

footer.jade

 p.footer Here is my footer 

Then run res.render('pagename'); .

If you do not want to have specific things in the footer on the page, there is no point in doing this in a block.

+21
source

All Articles