Reputation: 141
In ejs we can include a partials in a template in this way (suppose that header.hjs is in view/partials path):
<% include ./partials/header %>
How can I do this in hjs?
Upvotes: 0
Views: 257
Reputation: 141
I got the answer from this link (the sample in this link uses layout and partials and I just used partials for my case to include a navBar):
The solution is:
In app.js (server.js) define the partial:
app.set('partials', { navBarPartial: 'navBarPartial' } );
In the view which you need this partial, include it:
<html>
<head>
</head>
<body>
...
{{> navBarPartial}}
...
</body>
</html>
Upvotes: 0