am new to mongoDB and eJS, am trying to display the content according to the collection id click, if i console the id am getting the id but if am pushing the content to the detials am getting an error: Error: Could not find matching close tag for "<%=". please what am I doing wrong here?
Here's my code
//my app.js file
app.get("/blogs/:id", (req, res) => {
const id = req.params.id
console.log(id)
Blog.findById(id)
.then((result) => {
res.render('details', {title: "details page", blog: result})
})
.catch(err => console.log(err))
})
my details file
<!DOCTYPE html>
<html lang="en">
<%- include("./partial/head.ejs") -%>
<body>
<div class="singleblog-page">
<%- include("./partial/nav.ejs") -%>
<div class="single-blog">
<h1><%=blog.title></h1>
<p><%=blog.body></p>
</div>
<%- include("./partial/footer.ejs") -%>
</div>
</body>
</html>
you didn't close ejs tags for these two lines -
<h1><%=blog.title></h1>
<p><%=blog.body></p>
Close the tags and the problem will be solved. This site is helpful if you are new to ejs: https://ejs.co/
<h1><%= blog.title %></h1>
<p><%= blog.body %></p>