Reputation: 7190
I'm using NodeJS, expressJS and ejs to load files. while rendering index.ejs app.get('/', function(req, res){ res.render('index');
, it loaded perfectly but when I'm embedding navbar.ejs in index.ejs <% include(includes/navbar.ejs) %>
it is loading fine (no error in console) but nothing is appearing on the page.
Folder managed:
project>app.js ,
project>pages>index.ejs ,
project>pages>includes>navbar.ejs
Upvotes: 0
Views: 175
Reputation: 3994
I believe you have a typo there in your syntax. You're missing the -
in the include. It should rather be
<%- include('includes/navbar.ejs'); %>
Also note that the path should be in quotes.
Upvotes: 1