summaryrefslogtreecommitdiff
path: root/layout/archive.ejs
blob: 620feb2753627fa08e28d0ea9f3c8c372d5bd41c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<div class="columns">
    <div class="column is-8 is-offset-2">
        <div class="archive">
            <% let lastyear = 0; let lastmonth = -1; %>
            <aside class="menu">
                <% site.posts.sort('date', -1).each(function(post) { %>
                    <% let year = post.date.year(); let month = post.date.month(); %>
                    <% if (lastyear !== year || lastmonth !== month) { %>
                        <% if (lastyear !== 0 || lastmonth !== -1){ %> 
                            </ul>
                        <% } %>
                        <p class="menu-label"><%- date(post.date, "YYYY.MMM"); %></p>
                        <ul class="menu-list">
                        <% lastyear = year; lastmonth = month; %>
                    <% } %>
                    <li>
                        <a class="title" href="<%- url_for(post.path) %>">
                            <%= post.title %>
                        </a>
                    </li>
                <% }) %>
            </aside>
        </div>
    </div>
</div>