<%- include('partials/header', {title: 'Home'}); %>


<body class="text-center">
    <div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
        <%- include('partials/navbar_loggedin') -%>

        <% posts.forEach(post => { %>
        <main role="main" class="feed">
            <h1 class="cover-heading feed-title"><%= post.title %></h1>
            <p class="lead feed-body"><%= post.body.length >= 50 ? post.body.substring(0, 50) : post.body %> <a class="feed-postlink" href="/<%= post.author %>/<%= post.postLink %>">read more...</a></p>
            <% if (post.imageSrc) { %>
                <img class="feed-image" src="<%=post.imageSrc %>" alt="Post image">
            <% } %>
            <a href="users/<%= post.author %>" class="feed-author"><%= post.author %></a>
        </main>
        <% }) %>


        <%- include('partials/footer') -%> 
    </div>
</body>

</html>