<!DOCTYPE html>
<html lang="en">

<head>
  <%- include('includes/head', { title: 'All Posts' }) %>
  <link rel="stylesheet" href="/styles/posts.css">
</head>

<body>
  <%- include('includes/header') %>
  <main id="all-posts">
    <h1>All Posts</h1>
    <% if(!data || data.length === 0) { %>
        <p>There is no post.</p>
        <a class="btn" href="/new-post">Create new post</a>
    <% } else{ %>
        <ol id="posts-list">
          <% for(const entry of data){ %>
            <li>
              <%- include("includes/post-item", {entry: entry}) %>
            </li>
          <% } %>
        </ol>
    <% } %>
   
   
  </main> 
</body>

</html>