blog-hexo/themes/hexo-theme-cosy/layout/archive.ejs

41 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-10-24 09:50:42 +08:00
<%- css("/css/efca006a.css")%>
<% var archive = {}; %>
2023-11-06 14:37:35 +08:00
<% site.posts.sort('-date').forEach(function(post){
var year = post.date.year();
if (!archive[year]) archive[year] = []
archive[year].push(post);
}); %>
2023-10-24 09:50:42 +08:00
<div class="archive scrollbar-obtrusive">
<ul>
<% for(var key in archive) { %>
<li>
<h2><%= key %></h2>
<ul class="timeline">
<% archive[key].forEach(function(post){ %>
<li>
<a class="timeline-item" href="<%- url_for(post.path) %>">
<div class="timeline-info">
<span><%= post.date.format('MM-DD HH:mm:ss') %></span>
</div>
<div class="timeline-marker"></div>
<div class="timeline-content">
<div class="timeline-title">
<% if(post.status !==undefined){ %>
<%- post_icon(post,'status') %>
<% } %>
<span><%= post.title %></span>
</div>
<p><%= generate_excerpt(post, 100) %>...</p>
</div>
</a>
</li>
<% }) %>
</ul>
</li>
<% } %>
</ul>
</div>
<%- js("/js/31d6cfe0.js")%>