1. 文章详情页面显示的文章链接错误
修改themes/hexo-theme-matery/layout/_partial/reprint-statement.ejs
中相关的链接部分
文章链接在第25行,将其修改为以下内容:
<a href="<%- url_for(page.permalink) %>"><%- url_for(page.permalink) %></a>
2. 页脚动态显示时间
将themes/hexo-theme-matery/layout/_partial/footer.ejs
中的calcSiteTime
改为以下内容:
var calcSiteTime = function () {
var seconds = 1000;
var minutes = seconds * 60;
var hours = minutes * 60;
var days = hours * 24;
var years = days * 365;
var today = new Date();
var startYear = "<%- theme.time.year %>";
var startMonth = "<%- theme.time.month %>";
var startDate = "<%- theme.time.date %>";
var startHour = "<%- theme.time.hour %>";
var startMinute = "<%- theme.time.minute %>";
var startSecond = "<%- theme.time.second %>";
var todayYear = today.getFullYear();
var todayMonth = today.getMonth() + 1;
var todayDate = today.getDate();
var todayHour = today.getHours();
var todayMinute = today.getMinutes();
var todaySecond = today.getSeconds();
var t1 = Date.UTC(startYear, startMonth, startDate, startHour, startMinute, startSecond);
var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
var diff = t2 - t1;
var diffYears = Math.floor(diff / years);
var diffDays = Math.floor((diff / days) - diffYears * 365);
var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
// 区分是否有年份.
var language = '<%- config.language %>';
if (startYear === String(todayYear)) {
document.getElementById("year").innerHTML = todayYear;
var daysTip = 'This site has been running for ' + diffDays + ' days';
daysTip = "本站已安全运行 "+/*diffYears+" 年 "+*/diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
document.getElementById("sitetime").innerHTML = daysTip;
document.getElementById("year").innerHTML = startYear + " - " + todayYear;
} else {
document.getElementById("year").innerHTML = startYear + " - " + todayYear;
var yearsAndDaysTip = 'This site has been running for ' + diffYears + ' years and '
+ diffDays + ' days';
yearsAndDaysTip = "本站已安全运行 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
document.getElementById("sitetime").innerHTML = yearsAndDaysTip;
document.getElementById("year").innerHTML = startYear + " - " + todayYear;
}
}
3.首页视频显示错误
将themes/hexo-theme-matery/layout/_widget/video.ejs
中第15行改为:
<iframe src='<%- theme.video.iframeUrl %>' scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" align="middle" <% if (theme.video.height) { %> style="height: <%- theme.video.height %>px;"<% } %> width="100%"> </iframe>
4.添加waline评论
修改config.yml
中waline部分内容,添加自己的serverURL
。
修改themes/hexo-theme-matery/layout/_partial/waline.ejs
的202行-最后:
<script src="//cdn.jsdelivr.net/npm/@waline/client"></script>
<!-- 你需要自行修改替换 `v2` 为你想要的版本号 -->
<!-- <script src="https://unpkg.com/@waline/client@v2.6.3/dist/waline.js"></script> -->
<!-- <script src="<%- theme.jsDelivr.url %><%- url_for(theme.libs.js.waline) %>"></script> -->
<script>
new Waline({
el: '#waline',
serverURL: '<%- theme.waline.serverURL %>',
path: window.location.pathname,
avatar: '<%- theme.valine.avatar %>',
requiredMeta: ['mail'],
visitor: true,
notify: true,
comment: true,
verify: false,
pageview: false,
update: true,
enableQQ: true,
"emoji": [
'https://unpkg.com/@waline/emojis@1.0.1/qq',
'https://unpkg.com/@waline/emojis@1.0.1/weibo',
'https://unpkg.com/@waline/emojis@1.0.1/bilibili',
],
"locale": {
"nick": '昵称',
"mail": '邮箱(必填)',
"mailError": '请填写正确的邮件地址',
"link": '网址',
"placeholder": '众里寻他千百度,蓦然回首,那人却在,灯火阑珊处...',
"sofa": '众里寻他千百度,蓦然回首,那人却在,灯火阑珊处...',
"submit": '提交',
"reply": '回复',
"cancelReply": '取消回复',
"comment": '评论',
"more": '加载更多...',
"preview": '预览',
"emoji": '表情',
"uploadImage": '上传图片',
"seconds": '秒前',
"minutes": '分钟前',
"hours": '小时前',
"days": '天前',
"now": '刚刚',
"uploading": '正在上传',
"login": '登录',
"logout": '退出',
"admin": '博主',
"word": '字',
"level0": '菜鸡',
"level1": '小白',
"level2": '掌握',
"level3": '精通',
"level4": '大佬',
"level5": '巨佬',
}
});
</script>