<li id="post-<%= post._id %>">

    <div id="head">

        <img src="<%= post.user.avatar %>" alt="" width="20">

        <small>
            <%= post.user.name %>
        </small>

        <% if(locals.user && post.user.id==user.id){%>
            <a class="delete-button" href="/post/destroy/<%=post.id%>">
                <i class="fa-solid fa-trash"></i>
            </a>
            <%}%>

    </div>

    <div id="content">
        <div id="img">
            <img src="<%= post.img %>" width="20">
        </div>
        <p>
            <%= post.content %>
        </p>
    </div>

    <div id="comment">

        <small id="like-comment">
            <% if(locals.user) {%>
                <a class="toggle-like-button" data-likes="<%=post.likes.length %>"
                    href="/like/toggle/?id=<%=post._id%>&type=Post">

                    <span style="color: black;">
                        <i class="fa-solid fa-thumbs-up fa-1x"></i>
                    </span>

                    <%=post.likes.length%> Likes
                </a>
                <%} else {%>
                    <%=post.likes.length %> Likes
                        <%}%>

        </small>
        <% if (locals.user){ %>
            <form id="comment-form-<%=post._id%>" action="/comment/create-comment" method="post">
                <input id="text" type="text" name="content" placeholder="Add a comment..." required>
                <input type="hidden" name="post" value="<%= post._id %>">
                <input id="submit" type="submit" value="Post">
            </form>
            <% } %>
    </div>




    <div class="post-comments-list">
        <ul id="post-comments-<%= post._id %>">
            <% for (comment of post.comments){%>
                <%- include('_comment') -%>
                    <%} %>
        </ul>
    </div>


</li>