The original method for what you asked for would use partial ones. Particles have been removed and replaced with the include
EJS function. Here is how you would include the file:
<% include header.html %> <% include footer.html %>
Any locals that you go to the rendering page are also passed to include. For instance:
app.js
app.get('/', function(req, res) { res.render(__dirname + '/index.html', { string: 'random_value', other: 'value' }); });
index.html
<!DOCTYPE html> <body> <%= other %> <% include content.html %> </body>
content.html
<pre><%= string %></pre>
The result is HTML:
<!DOCTYPE html> <body> value <pre>random_value</pre> </body>
source share