I have a route defined as
server.get('/', function (req, res) {
console.log('INDEX!');
res.render('index.jade', {
locals: {
title: 'Your Page Title',
description: 'Your Page Description',
author: 'Your Name'
}
});
});
And index.jade is defined as:
div hello world!!
But what I visit http://localhost:8081/ all I see is the layout, no "hello world!". I didn't even extend the layout in my view... why is this happening?
INDEX! is being rendered to my console, so I know it's hitting that route.
Remove the .jade:
res.render('index', {
locals: {
title: 'Your Page Title',
description: 'Your Page Description',
author: 'Your Name'
}
});
Also make sure you have your view configuration set correctly:
server.set('views', __dirname + '/views');
server.set('view engine', 'jade');
I needed to add
server.set("view options", { layout: false });
To tell express not to use the default layout automatically. I guess because my view didn't define the content block (used in my layout) none of my content was appearing; only the layout.