I'm new to nodejs and jade and following a small blog tutorial. I got the jade page working properly without extending layout. The moment I extend layout in my index.jade the page goes blank. Any idea what's going on here?
Layout.jade:
doctype 5
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
index.jade (without the extends layout)
h1= locals.title
#articles
- each article in locals.articles
div.article
div.created_at= article.created_at
div.title
a(href="/blog/"+article._id)!= article.title
div.body= article.body
And the rendering in app.js
app.get('/', function(req, res) {
articleProvider.findAll(function(error, docs) {
res.render('index.jade', { locals: {
title: "Blog",
articles: docs
}
});
});
});
Figured it out by not using the extend alone but the block aswell (see layout/block documentation)
extends layout
block content
h1= locals.title
Instead of
extends layout
h1= locals.title