I don't want it to be layout.ejs.
I want to set my layout to be another template for THIS specific controller.
Try using:
app.set("view options", { layout: "mylayout.jade" });
Use the layout
option to res.render()
res.render('page', { layout: 'mylayout.jade' })
Providing you're using the Ejs-express-layouts module you can specify a layout for a particular view, overriding the default:
app.get('/', function(req, res){
res.render('aView', { layout: 'someSpecificLayout' })
})
Just set layout property in express app settings.
app.set('layout', 'layouts/layout');
Just pass layout as render locals object.
app.get('/', function(req, res) {
res.render('the-view', { layout: 'specific-layout' });
);
More info here: https://www.npmjs.com/package/express-ejs-layouts
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.