54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
<%
|
|
if(is_archive()){
|
|
page.title = __('文章归档')
|
|
}
|
|
%>
|
|
<%- css('css/archive.css') %>
|
|
<%- partial('_partial/header',{name:'archive'}) %>
|
|
<%
|
|
var years = {};
|
|
var PageNum = 0;
|
|
var PageYear = 0;
|
|
site.posts.sort('date').reverse().forEach(function(post){
|
|
var year = post.date.year()
|
|
if(years[year]===undefined){
|
|
years[year] = [];
|
|
PageYear += 1;
|
|
}
|
|
years[year].push(post);
|
|
PageNum += 1;
|
|
});
|
|
%>
|
|
<div class="header-bg">
|
|
<div class="bg-content">
|
|
<span>
|
|
<img src="<%- theme.topIcon.archivesIcon %>" alt="Q">
|
|
</span>
|
|
|
|
<h2>居然用了 <%- PageYear %> 年一共才写了 <%- PageNum %> 篇文章!</h2>
|
|
</div>
|
|
</div>
|
|
<div class="article-content">
|
|
<div id="article" class="content">
|
|
<% Object.keys(years).reverse().forEach(function(year){ %>
|
|
<p>
|
|
<%= year %>
|
|
</p>
|
|
<% years[year].map(function(post){ %>
|
|
<a href="<%- config.root %><%- post.path %>">
|
|
<span><%- (post.title || "Untitled").replace(/[<>&"]/g,function(c){
|
|
return {'<':'<','>':'>','&':'&','"':'"'}[c];
|
|
}) %></span>
|
|
<time><%= post.date.format('MM-DD') %></time>
|
|
</a>
|
|
<% }) %>
|
|
<% }) %>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
$(function () { $('.article-content').addClass('content-move'); })
|
|
</script> |