<% if (pagination == 1) { %> 最近动态 <% } else if (pagination == 2) { %> <%- page.category %> 分类下的文章 <% } else if (pagination == 3) { %> <%- page.tag %> 标签下的文章 <% } else { %> 文章归档 <% } %>

<% if(pagination) { page.posts.each(function(post) { %> <%-partial('archive-post', { post: post }) %> <% }) } else { let lastYear, lastMonth; let currentPosts = []; site.posts.each(function(post) { if(post.date.year() == page.year && (post.date.month()+1 == page.month || !page.month)) { currentPosts.push(post) } }) currentPosts.sort(function(a, b){ return b.date - a.date;}); currentPosts.forEach(function(post) { if(post.date.year() !== lastYear || post.date.month()+1 !== lastMonth) { if(lastYear && lastMonth) { %> <% } %>

<%= post.date.year() %>年<%= post.date.month()+1 %>月

<% } %> <% if (pagination && page.total >= 1){ %> <% } %>