blog-hexo/themes/hexo-theme-linear/layout/archive.ejs
2023-10-19 21:55:22 +08:00

48 lines
1.1 KiB
Plaintext

<%- css("/css/efca006a.css")%>
<% var archive = {}; %>
<% site.posts.forEach(function(post){ %>
<% var year = post.date.year(); %>
<% if(!archive[year]) { %>
<% archive[year] = []; %>
<% } %>
<% archive[year].push(post); %>
<% }); %>
<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")%>