I'm trying to setup my first app using EJS (Normally use Jade) and I've got it all setup and my pages are loading, I followed a tutorial on how to do it, this is my layout
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8">
<title>
<%= title %>
</title>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
<!-- HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<%- body %>
</body>
</html>
and this is my Home page
<div class='title'>
<%= title %>
</div>
But when I load the home page, and view page source, all I see is the Home page elements, I don't see html, body, head, title any of that stuff. Not sure why, this is my app.js
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
and my 2 files are layout.ejs, index.ejs
Thanks in advance!
Following: http://robdodson.me/blog/2012/05/31/how-to-use-ejs-in-express/
Recent versions of Express (3.x) don't support layouts anymore (see this migration page).
Instead (also suggested by the migration page), you can use ejs-locals to get back that functionality. The GitHub page of ejs-locals gives some easy examples how to get layouts working with Express 3.
app.set('view engine', 'ejs');
add this to app.js