主题改造 归档页面

This commit is contained in:
结发受长生
2018-05-17 17:29:42 +08:00
parent d96d550776
commit f5505a48cf
16 changed files with 136 additions and 96 deletions
@@ -1,4 +1,3 @@
<!-- 这里放网站js脚本 -->
<%- js('js/main') %>
<%- js('js/lib/polyfill.min') %>
<%- js('js/lib/vue.min') %>
@@ -1,7 +1,7 @@
<!-- 文章 -->
<article class="post">
<header>
<!-- 标签这有且只能显示一个 -->
<!-- 分类 -->
<% if (post.categories && post.categories.length) { %>
<%-
list_categories(post.categories, {
@@ -9,7 +9,7 @@
class: 'cat',
style: 'none',
separator: '|'
}).split('|')[0]
})
%>
<% } else { %>
<a href="javascript: void(0);" class="cat">未分类</a>
@@ -18,7 +18,7 @@
<%- partial('post/title', { class_name: 'post-title' }) %>
</header>
<p class="post-meta">
<%- post.author || '柠烟夏季' %> 发表于
<%- post.author || config.author %> 发表于
<%- partial('post/date', { date_format: 'YYYY-MM-DD' }) %>
&nbsp;&nbsp;
<span class="post-tags">
@@ -1,27 +1,64 @@
<% if (index == true) { %>
<h3 class="widget-hd">
<strong>
<% if (pagination == 2) { %>
最近动态
<% } else if (pagination == 3) { %>
文章归档
<% } else if (pagination == 4) { %>
`<%- page.category %>`分类下的文章
<% } else if (pagination == 5) { %>
`<%- page.tag %>`标签下的文章
<% } %>
</strong>
</h3>
<% page.posts.each(function(post) { %>
<%- partial('archive-post', { post: post }) %>
<% }) %>
<% if (page.total >= 1){ %>
<nav class="page-navigator">
<%- paginator({
prev_text: '前一页',
next_text: '后一页'
}) %>
</nav>
<h3 class="widget-hd">
<strong>
<% if (pagination == 1) { %>
最近动态
<% } else if (pagination == 2) { %>
<%- page.category %> 分类下的文章
<% } else if (pagination == 3) { %>
<%- page.tag %> 标签下的文章
<% } else { %>
文章归档
<% } %>
</strong>
</h3>
<%
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) { %> </ul> <% }
%>
<h3 class="widget-date">
<strong><%= post.date.year() %>年<%= post.date.month()+1 %>月</strong>
</h3>
<ul class="archive-wapper">
<%
}
%>
<li class="archive-item">
<a href="<%=url_for(post.permalink) %>">
<div class="archive-div">
<%=post.title %>
</div>
</a>
</li>
<%
lastYear = post.date.year();
lastMonth = post.date.month()+1;
})
%> </ul> <%
}
%>
<% if (pagination && page.total >= 1){ %>
<nav class="page-navigator">
<%- paginator({
prev_text: '前一页',
next_text: '后一页'
}) %>
</nav>
<% } %>
@@ -1,11 +1,10 @@
<% if (theme.share) { %>
<% if (theme.share.enable) { %>
<div class="article-share clearfix text-center">
<div class="share-area">
<span class="share-txt">分享到:</span>
<a href="javascript:void(0);" class="share-icon weibo" onclick="JELON.Utils.share('weibo')"></a>
<a href="javascript:void(0);" class="share-icon qqzone" onclick="JELON.Utils.share('qqzone')"></a>
<a href="javascript:void(0);" class="share-icon qq" onclick="JELON.Utils.share('qq')"></a>
<a href="javascript:void(0);" class="share-icon douban" onclick="JELON.Utils.share('douban')"></a>
<% for (let i in theme.share.list) { %>
<a href="javascript:void(0);" class="share-icon <%= theme.share.list[i] %>" onclick="JELON.Utils.share('<%= theme.share.list[i] %>')"></a>
<% } %>
</div>
</div>
<% } %>
@@ -5,18 +5,17 @@
<%- partial('_widget/categorys') %>
</section>
<% if (theme.tagcloud) { %>
<% if (theme.tagcloud.enable) { %>
<section class="widget">
<h3 class="widget-hd"><strong>热门标签</strong></h3>
<%- partial('_widget/tags_cloud') %>
</section>
<% } %>
<% if (theme.weibo_show.enable) { %>
<!-- 我的微博 -->
<% if (theme.archives.enable) { %>
<section class="widget">
<h3 class="widget-hd"><strong>我的微博</strong></h3>
<%- partial('_widget/weibo') %>
<h3 class="widget-hd"><strong>文章归档</strong></h3>
<%- list_archives({format: theme.archives.date_format}) %>
</section>
<% } %>