2020-03-15 17:39:18 +08:00
|
|
|
<!-- 归档页面 内容 -->
|
2020-03-19 18:11:13 +08:00
|
|
|
<!-- 如果是归档页面,将网站所有文章列出来,否则列出其他页(分类,标签)下的文章 -->
|
|
|
|
<% const posts = is_archive() ? site.posts : page.posts %>
|
|
|
|
<div class="archive-container">
|
|
|
|
<!-- 把所有文章按年份分类显示 -->
|
|
|
|
<% let last; %>
|
|
|
|
<% posts.each(function(post, i){ %>
|
|
|
|
<% let year = post.date.year(); %>
|
|
|
|
<% if (last != year) { %>
|
|
|
|
<% if (last != null){ %>
|
|
|
|
</div></section>
|
|
|
|
<% } %>
|
|
|
|
<% last = year; %>
|
|
|
|
<section class="archives-wrap">
|
|
|
|
<div class="archive-year">
|
|
|
|
<%= year %>
|
|
|
|
</div>
|
|
|
|
<div class="archive-article-list">
|
|
|
|
<% } %>
|
|
|
|
<div class="archive-article-item">
|
|
|
|
<a class="archive-article-title" href="<%- url_for(post.path) %>"><%= post.title %></a>
|
|
|
|
<span class="archive-article-date"> <%= date(post.date, 'MM-DD') %> </span>
|
2020-03-17 17:58:18 +08:00
|
|
|
</div>
|
2020-03-19 18:11:13 +08:00
|
|
|
<% }) %>
|
|
|
|
<% if (posts.length){ %>
|
2020-03-17 17:58:18 +08:00
|
|
|
</div>
|
2020-03-19 18:11:13 +08:00
|
|
|
</section>
|
2020-03-17 17:58:18 +08:00
|
|
|
<% } %>
|
2020-03-19 18:11:13 +08:00
|
|
|
</div>
|
2020-03-17 17:58:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|