I’m creating a node.js project that uses express.js and jade. I’m trying to reate a default layout that when a user’s logged in will show their avatar, new messages, and stuff like that. Is this possible? I’ve tried searching google and got nothing back, even after replacing jade with django, rails, etc. Thank you for your consideration.
I’m creating a node.js project that uses express.js and jade. I’m trying to reate
Share
Yes, this is possible. you can create your own template and even override them using block and extend keywords of jade.
A block is simply a “block” of Jade that may be replaced within a child template, this process is recursive.
Now to extend the layout, simply create a new file and use the extends directive as shown below, giving the path.
For details see “Template inheritance”. https://github.com/visionmedia/jade