kartik tyagi
kartik tyagi

Reputation: 7190

ejs file loaded but nothing appears

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

Answers (1)

Stephen S
Stephen S

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

Related Questions