0
votes

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

1

1 Answers

1
votes

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.