主题改造 归档页面
This commit is contained in:
@@ -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' }) %>
|
||||
|
||||
<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>
|
||||
<% } %>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<% site.categories.forEach(function(cat){ %>
|
||||
<li>
|
||||
<a href="<%= url_for(cat.path) %>"><%= cat.name %></a>
|
||||
<span class="badge">(<%= cat.length %>)</span>
|
||||
<span class="badge"><%= cat.length %></span>
|
||||
</li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
@@ -1,11 +1,8 @@
|
||||
<!-- 文章分类 -->
|
||||
<!-- 友情链接 -->
|
||||
<ul class="widget-bd">
|
||||
<%
|
||||
var list = theme.friends['list'];
|
||||
for (var i in list) {
|
||||
%>
|
||||
<li>
|
||||
<a href="<%= list[i].link %>" target="_blank" title="<%= list[i].title %>"><%= list[i].name %></a>
|
||||
</li>
|
||||
<% } %>
|
||||
<% for (var i in theme.friends['list']) { %>
|
||||
<li>
|
||||
<a href="<%= list[i].link %>" target="_blank" title="<%= theme.friends['list'][i].title %>"><%= theme.friends['list'][i].name %></a>
|
||||
</li>
|
||||
<% } %>
|
||||
</ul>
|
||||
@@ -5,7 +5,7 @@
|
||||
max_font: 30,
|
||||
amount: 999,
|
||||
color: true,
|
||||
start_color: '#e87474',
|
||||
end_color: '#524ac5',
|
||||
start_color: '#'+theme.tagcloud.start_color,
|
||||
end_color: '#'+theme.tagcloud.end_color
|
||||
}) %>
|
||||
</div>
|
||||
@@ -1,29 +0,0 @@
|
||||
<div class="widget-bd" style="position: relative;">
|
||||
<div id="myWeiboLoading" class="text-center" style="position:absolute;top:0;left:0;right:0;bottom:0;line-height:50px;font-size:12px;background-color:#fff;z-index:9;">微博加载中...</div>
|
||||
<%- theme.weibo_show.code %>
|
||||
<script>
|
||||
(function () {
|
||||
var oMyWeibo = document.getElementById('myWeibo');
|
||||
var oMyWeiboLoading = document.getElementById('myWeiboLoading');
|
||||
var isIE = /msie/i.test(navigator.userAgent) && !window.opera;
|
||||
var timer = null;
|
||||
if (isIE) {
|
||||
oMyWeibo.onreadystatechange = function(){
|
||||
if(oMyWeibo.readyState === 'loaded' || oMyWeibo.readyState === 'complete'){
|
||||
timer = setTimeout(function () {
|
||||
oMyWeiboLoading.parentNode.removeChild(oMyWeiboLoading);
|
||||
timer = null;
|
||||
}, 300);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
oMyWeibo.onload = function () {
|
||||
timer = setTimeout(function () {
|
||||
oMyWeiboLoading.parentNode.removeChild(oMyWeiboLoading);
|
||||
timer = null;
|
||||
}, 300);
|
||||
};
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- 文章归档 -->
|
||||
<%- partial('_partial/archive', { pagination: 3, index: true }) %>
|
||||
<%- partial('_partial/archive', { pagination: false, index: true }) %>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- 文章分类 -->
|
||||
<%- partial('_partial/archive', { pagination: 4, index: true }) %>
|
||||
<%- partial('_partial/archive', { pagination: 2, index: true }) %>
|
||||
@@ -2,5 +2,5 @@
|
||||
<% if (page.content) { %>
|
||||
<%- page.content %>
|
||||
<% } else { %>
|
||||
<%- partial('_partial/archive', { pagination: 2, index: true }) %>
|
||||
<%- partial('_partial/archive', { pagination: 1, index: true }) %>
|
||||
<% } %>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<!-- 按标签分类 -->
|
||||
<%- partial('_partial/archive', { pagination: 5, index: true }) %>
|
||||
<%- partial('_partial/archive', { pagination: 3, index: true }) %>
|
||||
Reference in New Issue
Block a user