Hello, while watching the node.js tutorial I bumped into something like this:
The person that was recording it created the views folder containing all .ejs
files. In one of them, named login.ejs
he put this code:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<!-- meta tags, links, scripts etc. -->
</head>
<body>
<div class="container">
<%- body %>
</div>
</body>
</html>
And in the others .ejs
files he just wrote HTML code without html, body
tags, so I of course came to conclusion that layout.ejs
is template for others .ejs
files where everything is put inside this <%- body %>
place. However he hasn’t specified anywhere that other files shoud go there so I’m asking for more information about this <%- body %>
element and where I can read about it more? I understand the basics of ejs but I can’t grasp what’s documentation of ejs is telling about this ‘strange’ element.