Global variable for Jade templates in node.js
问题 I am using node.js with Jade templating system. Assume, I have these routing rules: // ./routes/first.js exports.first = function(req, res) { res.render('first', { author: 'Edward', title: 'First page' }); }; // ./routes/second.js exports.second = function(req, res) { res.render('second', { author: 'Edward', title: 'Second page' }); }; And these dummy views: // ./views/first.jade html head title #{author} – #{title} body span First page content // ./views/second.jade html head title #{author}