diff options
author | Doge <[email protected]> | 2021-05-10 01:14:07 +0800 |
---|---|---|
committer | Doge <[email protected]> | 2021-05-10 01:14:07 +0800 |
commit | 04f8c17b735dd7c25b9794441890754bc4e33f36 (patch) | |
tree | b08a995f786abc59455ac072c3707c37dfeca648 /layout | |
parent | 03a1b17b9dea3a81e9610e961b99b2465c4e7c57 (diff) | |
download | chromate-04f8c17b735dd7c25b9794441890754bc4e33f36.tar.gz chromate-04f8c17b735dd7c25b9794441890754bc4e33f36.tar.bz2 chromate-04f8c17b735dd7c25b9794441890754bc4e33f36.zip |
Complete archives
Diffstat (limited to 'layout')
-rw-r--r-- | layout/archive.ejs | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/layout/archive.ejs b/layout/archive.ejs index 8b8f001..a15573f 100644 --- a/layout/archive.ejs +++ b/layout/archive.ejs @@ -1,14 +1,21 @@ -<section class="archive"> - <ul class="archive-posts"> - <% page.posts.each(function(post) { %> - <li class="archive-post"> - <div class="archive-post-time"> - <%- date(post.date, theme.timeformat) %> - </div> - <a class="archive-post-title" href="<%- url_for(post.path) %>"> +<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> - <% }); %> - </ul> -</section>
\ No newline at end of file + <% }) %> + </aside> +</div>
\ No newline at end of file |