hexo-theme-amane/layout/common/archive.ejs

60 lines
1.9 KiB
Plaintext

<% switch (type) {
case 'archive':
var last;
page.posts.each(function(post, i) {
var year = post.date.year();
if (last != year) {
if (last != null) { %>
</div></section>
<% }
last = year; %>
<div class="archive-year-wrap">
<a href="<%- url_for('archives/' + year) %>" class="archive-year"><%= year %></a>
</div>
<section class="archives-wrap">
<div class="archives">
<% } %>
<%- partial('summary', {post: post, archive: true}) %>
<% });
if (page.posts.length) { %>
</div></section>
<% }
break;
case 'category': %>
<section class="archives-wrap">
<div class="archive-category-wrap">
<span class="archive-category"><%= page.category %></span>
</div>
<div class="archives">
<% page.posts.each(function (post, i) { %>
<%- partial('summary', {post: post, archive: false}) %>
<% }); %>
</div></section>
<%
break;
case 'tag': %>
<section class="archives-wrap">
<div class="archive-tag-wrap">
<span class="archive-tag">#<%= page.tag %></span>
</div>
<div class="archives">
<% page.posts.each(function (post, i) { %>
<%- partial('summary', {post: post, archive: false}) %>
<% }); %>
</div></section>
<%
break;
default:
page.posts.each(function(post) { %>
<%- partial('article', { post: post, index: true }) %>
<% })
break;
}
if (page.total > 1) { %>
<nav id="page-nav">
<%- paginator({
prev_text: '&laquo; ' + __('nav.prev'),
next_text: __('nav.next') + ' &raquo;'
}) %>
</nav>
<% } %>