ejs include function can not find the template with html extension
arrr ;)
- you did not mention what app - so I assume Express >=3
- solution : forget the dot and __express in
app.engine('.html', require('ejs').__express);
It should read :
app.engine('html', require('ejs').renderFile);
You can use .ejs files directly by using app.set('view engine', 'ejs');
and renaming index.html to index.ejs.
Here is an example: http://robdodson.me/blog/2012/05/31/how-to-use-ejs-in-express/
As Elie Gnrd is suggesting, you use .ejs
files directly by changing the view engine
configuration of Express.
If that isn't an option, and you want/need to keep using .html
as an extension for your templates, you have to be explicit in the include:
<% include head.html %>