hexo-theme-ayer/layout/_partial/archive.ejs

59 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-12-03 11:37:44 +00:00
<section class="outer">
2020-09-01 02:47:02 +00:00
<% if (theme.broadcast.enable && pagination == 2){ %>
<%- partial('_partial/broadcast') %>
<% } %>
2019-12-03 11:37:44 +00:00
<article class="articles">
<%
var title = '';
if (page.category) title = page.category;
if (page.tag) title = "#" + "&nbsp" + page.tag;
if (page.archive) {
if (page.year) title = page.year + (page.month ? '/' + page.month : '');
else title = __('archive_a');
}
%>
2020-01-09 11:55:59 +00:00
<% if (pagination !== 2){ %>
2019-12-03 11:37:44 +00:00
<h1 class="page-type-title"><%- title %></h1>
2020-01-09 11:55:59 +00:00
<% } %>
2019-12-03 11:37:44 +00:00
<% if (pagination == 2){ %>
<% page.posts.each(function(post){ %>
<%- partial('article', {post: post, index: true}) %>
<% }) %>
</article>
<% } else { %>
<% var last; %>
<% page.posts.each(function(post, i){ %>
<% var year = post.date.year(); %>
<% if (last != year){ %>
<% if (last != null){ %>
</div>
</div>
<% } %>
<% last = year; %>
<div class="archives-wrap">
<div class="archive-year-wrap">
<a href="<%- url_for(config.archive_dir + '/' + year) %>" class="archive-year"><%= year %></a>
</div>
<div class="archives">
<% } %>
<%- partial('archive-post', {post: post, even: i % 2 == 0}) %>
<% }) %>
<% if (page.posts.length){ %>
</div>
</div>
<% } %>
<% } %>
<% if (page.total > 1){ %>
<nav class="page-nav">
<%
var prev_text = theme.nav_text.page_prev;
var next_text = theme.nav_text.page_next
%>
<%- paginator({
prev_text: prev_text,
next_text: next_text
}) %>
</nav>
<% } %>
</section>