Express’s layout layout uses

  express, node.js

Install express-ejs-layouts

npm install express-ejs-layouts

New default layout

layout.ejs

<!DOCTYPE html>
<html>
<head>
    <title><%= title %></title>
    <% include header.ejs %>
</head>
<body>


<div id="wrapper">
    <!-- Navigation -->
    <% include menu.ejs %>

    <div id="page-wrapper">

        <div class="container-fluid">

            <%- defineContent('pageSection') %>

        </div>
        <!-- /.container-fluid -->

    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->

<!-- foot js-->
<% include footer.ejs %>


</body>
</html>

Configuration

var expressLayouts = require('express-ejs-layouts');
app.use(expressLayouts);

Use

Ejs

<%- contentFor('pageSection') %>
this is home

When rendering, render home

router.get('/home', function(req, res, next) {
  res.render('home', { title: 'var'});
});

References