<main class="main">
    <% if (site.posts && site.posts.length > 0) { %>
        <% if (page.layout === 'category') { %>
            <div class="all-categories content-card">
                <% if (page.title) { %>
                    <h2>
                        <%= page.title %>
                    </h2>
                <% } %>
                <% if (site.categories && site.categories.length && site.categories.forEach) { %>
                    <% site.categories.sort('path').forEach((category) => { %>
                        <a class="<%= category.parent ? ' child' : ''%>" href="<%= url_for(category.path) %>">
                            <time>&nbsp;&nbsp;<%= category.name %></time>
                            <span class="title">
                                (<%= category.posts.length %>)
                            </span>
                        </a>
                        <br />
                    <% }) %>
                <% } %>
            </div>
        <% } else { %>
            <%- partial('_partial/post/post-list') %>
        <% } %>
    <% } %>
</main>
