对我的paperbox(现在这个主题,landscape plus基础修改而来的,我引用了)做基于自己喜好的改造;

Part4: 404与按月归档

没想到这么快就更新了23333

这次想做的事情增加到:

  • 一个是404页面的添加

  • 一个是按月归档

  • 评论系统

  • 阅读统计

  • 如果有机会,我想更换一个好看点的about me…

404

腾讯公益404考虑下

source/404.html
1
2
3
4
5
6
7
8
9
10
11
12
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Oops</title>
<span style="font-size:14px;"><html>
<head>
<title>公益404</title>
</head>
<body>
<script type="text/javascript" src="//qzonestyle.gtimg.cn/qzone/hybrid/app/404/search_children.js" charset="utf-8" homePageUrl="https://fatheadrat.tk/" homePageName="回到我的主页"></script>
</body>
</span>
</html>

按月归档

以前是按年归档的,比如

image-20191004114917485

现在:

image-20191004115000331

代码,修改成这个,从else开始;解释一下,其实就是正常的逻辑判断,加了个month

layout/_partial/archive.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<% } else { %>
<% var last; var lastmonth;%>
<% page.posts.each(function(post, i){ %>
<% var year = post.date.year(); %>
<!--这个month 取值 0-11,而且1 要表示成 01,所以要加0-->
<% var month = post.date.month()+1; month = ("0" + month).substr(-2)%>
<% if (last != year || lastmonth != month){ %>
<% if (last != null && last != lastmonth){ %>
</div></section>
<% } %>
<% last = year; %>
<% lastmonth = month; %>
<section class="archives-wrap">
<div class="archive-year-wrap">
<a href="<%- url_for('archives/' + year + '/' + month ) %>" class="archive-year"><%= year %>&nbsp;-&nbsp;<%= month %></a>
</div>
<div class="archives">