<!DOCTYPE html>
<html lang="en">
  <%- include("../partials/head.ejs") %>

  <body>
    <%- include("../partials/nav.ejs") %>
    <h1>Home</h1>
    <h2>Your path to becoming a Node.js ninja!</h2>
    <h2>All BLogs</h2>
    <div class="blogs content">
      <% if(blogs.length>0){ blogs.forEach(element => { %>

      <a href="/blogs/<%= element._id %>" class="blog">
        <h3 class="title"><%= element.title %></h3>
        <p class="snipper"><%= element.snippet %></p>
      </a>

      <% })}else{ %>
      <p>There are no blogs to display</p>
      <%} %>
    </div>

    <%- include("../partials/footer.ejs") %>
  </body>
</html>
