博客升级记录(2020.04.17)

前言

本博客建成于2018年(夏),当时是在我高中毕业的那个暑假,虽然对于这些代码等知识,还不了解,但凭着对于这种东西的热爱,还是废寝忘食的完成了。
但完成后的我发现,相比起写博客,我还是喜欢建设博客的过程,那种一点一点美化/优化的过程。所以建站快两年,日志还是就那几篇。。。惭愧。

更新总览

  • 更新前版本:Hexo-3.7.1 NexT-5.1.4
  • 更新后版本:Hexo-4.2.0 NexT-7.8.0

经过两年的更新,NexT主题相比原来集成了很多插件,比起当时,此版本在美化和优化设置上要简单得多。但相对的,更新起来更加的麻烦(主要是原来的设置/拓展过多),用git pull平滑更新会报错,只能手动更新,但也是个大工程。
所以,考虑到我的日志并不多,主要的美化还是在custom.swig文件中,以及我想用一下数据文件( Data File ),最后我决定直接放弃原来的版本,重新建设新版本,原来的日志手动升级过来。

数据文件

自从 NexT-7.3.0 开始,官方推荐采用数据文件将配置与主题分离,这样可以在不修改主题源码的同时完成选项配置自定义布局自定义样式,便于后续 NexT 版本更新。

更新内容

多评论系统:Valine/Gitalk 部署到 Coding 国内外分流 脚注 hexo-reference Github 贡献图 404页面 Followme 分享 折叠 暗/亮 谷歌日历 徽章 字体 主题样式 简繁切换 多级菜单 置顶 近期文章 博客备份 打字效果 点击效果 建站时间 页面宽度修改 BiliBili 追番列表 添加阿里图标 Steam 游戏标签

新增加内容(较前版本)

多评论系统

Next 现已支持多评论系统,原来我用的 Valine 评论系统,这次更新我尝试了 Gitalk 与 Disqus 评论,由于 Disqus 评论系统对于国内IP不是很友好(虽有 Disqus js 代理评论系统,但也没有太大实际用途),所以我放弃了 Disqus ,从而使用 Gitalk 与 Valine 双评论系统。

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Multiple Comment System Support
comments:
# Available values: tabs | buttons
style: buttons # 切换按钮风格
# Choose a comment system to be displayed by default.
# Available values: changyan | disqus | disqusjs | gitalk | livere | valine
active: valine # 默认评论系统
# 设置为true表示记住访问者选择的评论系统。
storage: true
# Lazyload all comment systems.
lazyload: false
# Modify texts or order for any navs, here are some examples.
nav:
disqusjs:
text:
order: -3
valine:
text: Valine评论
order: -2
gitalk:
text: Gitalk评论
order: -1

Valine

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Valine
# For more information: https://valine.js.org, https://github.com/xCss/Valine
valine:
enable: true
appid: # 您的leancloud应用程式appid
appkey: # 您的leancloud应用程序appkey
notify: false # 邮件通知
verify: false # 验证码
placeholder: # 评论框占位符
avatar: mm # Gravatar默认头像风格
guest_info: nick,mail,link # 自定义评论标题
pageSize: 10 # 分页大小
language: zh-cn # Language, available values: en, zh-cn
visitor: true # 文章阅读统计
comment_count: true # 如果为false,则评论计数将仅显示在帖子页面中,而不显示在主页中
recordIP: false # 是否记录评论者IP
serverURLs: # When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in)
#post_meta_order: 0

本博客 Valine 样式

位置:博客\source\_data\styles.styl(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//以下为亮/暗通用样式

//Valine输入区
.v[data-class=v] .vwrap {
transition-property: color,background;
transition-delay: 0s;
transition-duration: 1s;
transition-timing-function: ease-in-out;
box-shadow: 0px 0 13px 3px rgba(0,0,0,0.5);
border: none !important;
}
//Valine评论区
.v[data-class=v] .vcards .vcard {
transition-property: color,background;
transition-delay: 0s;
transition-duration: 1s;
transition-timing-function: ease-in-out;
box-shadow: 0px 0 13px 3px rgba(0,0,0,0.5);
margin-bottom: 19px;
}
.v[data-class=v] .vcards .vcard .vh {
border-bottom: none !important;
padding-right: 19px;
}
.v[data-class=v] .vcards .vcard .vquote {
border-left: 3px dashed !important;
}
////Valine展开
.v[data-class=v] .vcards .vcard .vcontent.expand {
max-height: 13em !important;
}
//Valine超链接
.v[data-class=v] a {
color: #b688ff !important;
font-weight: bold;
border: none !important;
transition-property: padding,border,color,background;
transition-delay: 0s;
transition-duration: 0.2s;
transition-timing-function: ease-in-out;
&:hover {
padding: 0px 3px !important;
}
}
//Valine回复按钮
.v[data-class=v] .vcards .vcard .vh .vmeta .vat {
color: #716486 !important;
font-weight: bold;
border: none !important;
transition-property: padding,border,color,background;
transition-delay: 0s;
transition-duration: 0.2s;
transition-timing-function: ease-in-out;
&:hover {
padding: 0px 3px !important;
}
}
//Valine头像
.v[data-class=v] .vcards .vcard .vimg {
margin-left: 6px;
}
.v[data-class=v] .vcards .vcard .vhead .vnick {
&:hover {
color: #b688ff !important;
font-weight: bold !important;
}
}
//Valine表情
.v[data-class=v] .vwrap .vemojis {
max-height: none !important;
}
.v[data-class=v] .emoji, .v[data-class=v] .vemoji {
max-width: 100% !important;
}
.v[data-class=v] .vwrap .vemojis i {
&:hover {
padding-top: 3px !important;
}
}
//Valine按钮
.v[data-class=v] .vicon {
&:hover {
fill: #b688ff !important;
}
&.actived {
fill: #b688ff !important;
}
}
邮件提醒

评论管理后台

环境变量
1
2
3
4
MAIL_SUBJECT: ${PARENT_NICK},您在${SITE_NAME}上的留言收到了回复
MAIL_SUBJECT_ADMIN: ${SITE_NAME}上有新留言
MAIL_TEMPLATE: <div style="border-radius: 10px 10px 10px 10px;font-size:13px; color: #555555;width: 666px;font-family:'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;margin:50px auto;border:1px solid #eee;max-width:100%;background: #ffffff repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);"><div style="width:100%;background:#49BDAD;color:#ffffff;border-radius: 10px 10px 0 0;background-image: -moz-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));background-image: -webkit-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));height: 66px;"><p style="font-size:15px;word-break:break-all;padding: 23px 32px;margin:0;background-color: hsla(0,0%,100%,.4);border-radius: 10px 10px 0 0;">您在<a style="text-decoration:none;color: #ffffff;" href="${SITE_URL}"> ${SITE_NAME}</a>上的留言有新回复!</p></div><div style="margin:40px auto;width:90%"><p>${PARENT_NICK} 同学,您曾在ColdCard's Blog上留言:</p><div style="background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;">${PARENT_COMMENT}</div><p>${NICK} 给您的回复:</p><div style="background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;">${COMMENT}</div><p>您可以点击<a style="text-decoration:none; color:#12addb" href="${POST_URL}#comments">此处跳转</a>,欢迎再次光临<a style="text-decoration:none; color:#12addb" href="${SITE_URL}"> ${SITE_NAME}</a></p><style type="text/css">a:link{text-decoration:none}a:visited{text-decoration:none}a:hover{text-decoration:none}a:active{text-decoration:none}</style></div></div>
MAIL_TEMPLATE_ADMIN: <div style="border-radius: 10px 10px 10px 10px;font-size:13px; color: #555555;width: 666px;font-family:'Century Gothic','Trebuchet MS','Hiragino Sans GB',微软雅黑,'Microsoft Yahei',Tahoma,Helvetica,Arial,'SimSun',sans-serif;margin:50px auto;border:1px solid #eee;max-width:100%;background: #ffffff repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 1px 5px rgba(0, 0, 0, 0.15);"><div style="width:100%;background:#49BDAD;color:#ffffff;border-radius: 10px 10px 0 0;background-image: -moz-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));background-image: -webkit-linear-gradient(0deg, rgb(67, 198, 184), rgb(255, 209, 244));height: 66px;"><p style="font-size:15px;word-break:break-all;padding: 23px 32px;margin:0;background-color: hsla(0,0%,100%,.4);border-radius: 10px 10px 0 0;">您的<a style="text-decoration:none;color: #ffffff;" href="${SITE_URL}"> ${SITE_NAME}</a>上有新的留言!</p></div><div style="margin:40px auto;width:90%"><p>${NICK} 给您的留言:</p><div style="background: #fafafa repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);margin:20px 0px;padding:15px;border-radius:5px;font-size:14px;color:#555555;">${COMMENT}</div><p>您可以点击<a style="text-decoration:none; color:#12addb" href="${POST_URL}#comments">此处跳转</a>,欢迎再次光临<a style="text-decoration:none; color:#12addb" href="${SITE_URL}"> ${SITE_NAME}</a></p><style type="text/css">a:link{text-decoration:none}a:visited{text-decoration:none}a:hover{text-decoration:none}a:active{text-decoration:none}</style></div></div>
定时任务

自动唤醒

检查邮件

添加自定义表情

Valine 支持自定义表情[10]

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
valine:
···
#设置Bilibili表情包地址
emojiCDN: 'https://valinecdn.bili33.top/'
#表情title和图片映射
emojiMaps: {
"doge": "bilibilitv/[tv_doge].png",
"亲亲": "bilibilitv/[tv_亲亲].png",
"偷笑": "bilibilitv/[tv_偷笑].png",
"再见": "bilibilitv/[tv_再见].png",
"冷漠": "bilibilitv/[tv_冷漠].png",
"发怒": "bilibilitv/[tv_发怒].png",
"发财": "bilibilitv/[tv_发财].png",
"可爱": "bilibilitv/[tv_可爱].png",
"吐血": "bilibilitv/[tv_吐血].png",
"呆": "bilibilitv/[tv_呆].png",
"呕吐": "bilibilitv/[tv_呕吐].png",
"困": "bilibilitv/[tv_困].png",
"坏笑": "bilibilitv/[tv_坏笑].png",
"大佬": "bilibilitv/[tv_大佬].png",
"大哭": "bilibilitv/[tv_大哭].png",
"委屈": "bilibilitv/[tv_委屈].png",
"害羞": "bilibilitv/[tv_害羞].png",
"尴尬": "bilibilitv/[tv_尴尬].png",
"微笑": "bilibilitv/[tv_微笑].png",
"思考": "bilibilitv/[tv_思考].png",
"惊吓": "bilibilitv/[tv_惊吓].png",
"打脸": "bilibilitv/[tv_打脸].png",
"抓狂": "bilibilitv/[tv_抓狂].png",
"抠鼻": "bilibilitv/[tv_抠鼻].png",
"斜眼笑": "bilibilitv/[tv_斜眼笑].png",
"无奈": "bilibilitv/[tv_无奈].png",
"晕": "bilibilitv/[tv_晕].png",
"流汗": "bilibilitv/[tv_流汗].png",
"流泪": "bilibilitv/[tv_流泪].png",
"流鼻血": "bilibilitv/[tv_流鼻血].png",
"点赞": "bilibilitv/[tv_点赞].png",
"生气": "bilibilitv/[tv_生气].png",
"生病": "bilibilitv/[tv_生病].png",
"疑问": "bilibilitv/[tv_疑问].png",
"白眼": "bilibilitv/[tv_白眼].png",
"皱眉": "bilibilitv/[tv_皱眉].png",
"目瞪口呆": "bilibilitv/[tv_目瞪口呆].png",
"睡着": "bilibilitv/[tv_睡着].png",
"笑哭": "bilibilitv/[tv_笑哭].png",
"腼腆": "bilibilitv/[tv_腼腆].png",
"色": "bilibilitv/[tv_色].png",
"调侃": "bilibilitv/[tv_调侃].png",
"调皮": "bilibilitv/[tv_调皮].png",
"鄙视": "bilibilitv/[tv_鄙视].png",
"闭嘴": "bilibilitv/[tv_闭嘴].png",
"难过": "bilibilitv/[tv_难过].png",
"馋": "bilibilitv/[tv_馋].png",
"鬼脸": "bilibilitv/[tv_鬼脸].png",
"黑人问号": "bilibilitv/[tv_黑人问号].png",
"鼓掌": "bilibilitv/[tv_鼓掌].png",
"2233娘_卖萌": "bilibili2233/[2233娘_卖萌].png",
"2233娘_吃惊": "bilibili2233/[2233娘_吃惊].png",
"2233娘_吐魂": "bilibili2233/[2233娘_吐魂].png",
"2233娘_喝水": "bilibili2233/[2233娘_喝水].png",
"2233娘_困惑": "bilibili2233/[2233娘_困惑].png",
"2233娘_大哭": "bilibili2233/[2233娘_大哭].png",
"2233娘_大笑": "bilibili2233/[2233娘_大笑].png",
"2233娘_委屈": "bilibili2233/[2233娘_委屈].png",
"2233娘_怒": "bilibili2233/[2233娘_怒].png",
"2233娘_无言": "bilibili2233/[2233娘_无言].png",
"2233娘_汗": "bilibili2233/[2233娘_汗].png",
"2233娘_疑问": "bilibili2233/[2233娘_疑问].png",
"2233娘_第一": "bilibili2233/[2233娘_第一].png",
"2233娘_耶": "bilibili2233/[2233娘_耶].png",
"2233娘_郁闷": "bilibili2233/[2233娘_郁闷].png",
"妙": "bilibiliHotKey/1.jpg",
"你细品": "bilibiliHotKey/10.jpg",
"锤": "bilibiliHotKey/11.jpg",
"秀": "bilibiliHotKey/12.jpg",
"你币有了": "bilibiliHotKey/13.jpg",
"这次一定": "bilibiliHotKey/14.jpg",
"酸了": "bilibiliHotKey/15.jpg",
"打卡": "bilibiliHotKey/16.jpg",
"神仙UP": "bilibiliHotKey/17.jpg",
"我太南了": "bilibiliHotKey/18.jpg",
"吹爆": "bilibiliHotKey/19.jpg",
"危": "bilibiliHotKey/2.jpg",
"奥力给": "bilibiliHotKey/20.jpg",
"AWSL": "bilibiliHotKey/21.jpg",
"猛男必看": "bilibiliHotKey/22.jpg",
"害": "bilibiliHotKey/23.jpg",
"知识盲区": "bilibiliHotKey/24.jpg",
"我全都要": "bilibiliHotKey/25.jpg",
"咕": "bilibiliHotKey/26.jpg",
"可以": "bilibiliHotKey/27.jpg",
"真香": "bilibiliHotKey/28.jpg",
"完结": "bilibiliHotKey/29.jpg",
"有内味了": "bilibiliHotKey/3.jpg",
"有生之年": "bilibiliHotKey/30.jpg",
"大师球": "bilibiliHotKey/31.jpg",
"爷关更": "bilibiliHotKey/32.jpg",
"高产": "bilibiliHotKey/4.jpg",
"我枯了": "bilibiliHotKey/5.jpg",
"不愧是你": "bilibiliHotKey/6.jpg",
"三连": "bilibiliHotKey/7.jpg",
"镇站之宝": "bilibiliHotKey/8.jpg",
"狼火": "bilibiliHotKey/9.jpg"
}

更多表情

Gitalk

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Gitalk
# For more information: https://gitalk.github.io, https://github.com/gitalk/gitalk
gitalk:
enable: true
github_id: # GitHub存储库所有者
repo: # 存储库名称用来存储问题
client_id: # GitHub Application Client ID
client_secret: # GitHub Application Client Secret
admin_user: # GitHub存储库所有者和合作者,只有这些人才能初始化gitHub问题
distraction_free_mode: true # Facebook-like distraction free mode
# Gitalk's display language depends on user's browser or system environment
# 如果您希望访问网站的所有人看到统一的语言,则可以设置强制语言值
# Available values: en | es-ES | fr | ru | zh-CN | zh-TW
language:

本博客 Gitalk 样式

位置:博客\source\_data\styles.styl(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//以下为亮/暗通用样式

//Gitalk
.gt-container .gt-comment-admin .gt-comment-content, .gt-container .gt-popup {
transition-property: color,background;
transition-delay: 0s;
transition-duration: 1s;
transition-timing-function: ease-in-out;
}
.gt-container .gt-comment-username, .gt-container .gt-header-controls-tip {
&:hover {
padding: 0px 3px !important;
}
}
.gt-container .gt-popup {
transition-duration: 0s;
}
.gt-container .gt-comment-username, .gt-container a, .gt-container .gt-header-controls-tip {
transition-property: padding,border,color,background;
transition-delay: 0s;
transition-duration: 0.2s;
transition-timing-function: ease-in-out;
color: #aba7d5 !important;
&:hover {
font-weight: bold !important;
}
}
.gt-container .gt-svg svg {
fill: #ccc !important;
&:hover {
fill: #aba7d5 !important;
}
}
//Gitalk按钮
.gt-container .gt-btn {
background-color: #9996bd !important;
color: #fff !important;
border: 1px solid #a29fc9 !important;
&:hover {
color: #000000 !important;
}
}
//Gitalk评论文字背景
.gt-container .gt-comment-body {
transition-property: color,background;
transition-delay: 0s;
transition-duration: 1s;
transition-timing-function: ease-in-out;
padding: 0px 3px !important;
}

Followme

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
# Subscribe through Telegram Channel, Twitter, etc.
# Usage: `Key: permalink || icon` (Font Awesome)
follow_me:
#GitHub: https://github.com/Cold-Card || fab fa-github
#Telegram: https://t.me/X_ColdCard_X || fab fa-telegram
Steam: https://steamcommunity.com/id/ColdCard || fab fa-steam
PlayStation: https://my.playstation.com/profile/X-ColdCard-X || fab fa-playstation
Xbox: https://account.xbox.com/profile?gamertag=ColdCard1230 || fab fa-xbox
#WeChat: /images/wechat_channel.jpg || fab fa-weixin
#Discord: https://discordapp.com/channels/@ColdCard || fab fa-discord
#RSS: /atom.xml || fa fa-rss

本博客 Followme 样式

位置:博客\source\_data\styles.styl(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//follwome
.followme {
background: #0000;
border: none;
margin: 0px 0px;
padding: 20px 0px;
}
.followme .social-list .social-item {
border: 2px dashed #ab99de00;
transition-property: font-weight,padding,border,color,background;
transition-duration: 0.3s;
transition-timing-function: ease-in-out;
transition-delay: 0s;
&:hover {
font-weight: bold;
border: 2px dashed #ab99de;
padding: 0em 1em;
}
}

404页面

由于本博客以前是发布在 Github 上,所以404页面默认是 Github 样式的,与博客不太搭,所以我加了一个自定义的404页面

  • 下面是方法

    本博客已更换新 404 页面代码及样式,详情请移步此日志

    博客\source下创建404文件夹,将自定义代码放入下面 Front-matter 的下面(以本博客的404代码为例)

    位置:博客\source\404\index.md(自行创建)
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    ---
    permalink: /404 # 强制链接为404
    comments: false # 关闭评论
    layout: true # 是否以主题样式渲染
    ---
    <div class="notfound"style="font-family:Source Code Pro;">
    <span style="display:block;">
    (<span style="color: #2796ec;">function</span>( inDevelopment ) {
    </span>

    <span style="display:block;">
    <span style="padding-left: 15px;color: #2796ec;">function</span> launch() {
    </span>

    <span style="display:block;">
    <span style="padding-left: 30px;color: #2796ec;">if</span>( inDevelopment ) {
    </span>

    <span style="display:block;">
    <span style="padding-left: 45px;color: #2796ec;">return;</span>
    </span>

    <span style="display:block;padding-left: 30px">}</span>

    <span style="color: #757575a2;font-style:italic; display:block;padding-left: 30px">//TODO</span>

    <span style="display:block;padding-left: 15px">}</span>

    <span style="display:block;">
    window.addEventListner( <span style="color: #e99d47;">'load'</span>, launch );
    </span>

    <span style="display:block;">
    }( <span style="color:#2796ec;">true</span> ));
    </span>

    <span style="color: #757575a2;font-style:italic; display:block;">// 404 page not found.</span>

    <span style="display:block;">
    <span style="color:#d65562;">if</span>(<span style="color:#4ca8ef;">!</span><span style="font-style: italic;color:#9c9c9c;">found</span>) {
    </span>

    <span style="display:block">
    <span style="padding-left: 15px;color:#2796ec;">throw</span>(<span style="color: #8e7ccf;">"(╯°□°)╯︵ ┻━┻"</span>);
    </span>

    <span style="display:block">}</span>

    <span style="color: #757575a2;font-style:italic;">// <a href="/">Go home!</a></span>
    </div>

    可能遇到的问题及解决方法

    • 404页面只在一级域名下一级子路径下能正常跳转显示,在二级及以上子路径下无法正常显示

      解决方法: 不要使用相对路径对依赖文件进行调用!!!使用链接形式对依赖文件进行调用
      例如

      1
      2
      <!---href="css样式地址"--->
      <link rel="stylesheet" href="https://coldcard.wang/404/404.css">
    • 按照很多博文描述的思路,将 html 依赖的 css 文件和 js 文件放在博客\source文件夹下或者博客\source\你创建的page文件夹下,在经过 hexo g 生成和 hexo d 上传后,无法正常调用依赖的两个文件

      解决方法:将依赖的 js 和 css 依赖文件放到主题\source文件下,而不是博客\source文件夹或博客\source\你创建的page文件夹

多级菜单

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Usage: `Key: /link/ || icon`
# Key is the name of menu item. If the translation for this item is available, the translated text will be loaded, otherwise the Key name will be used. Key is case-senstive.
# Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon.
# When running the site in a subdirectory (e.g. yoursite.com/blog), remove the leading slash from link value (/archives -> archives).
# External url should start with http:// or https://
menu:
home: / || fa fa-home
about: /about/ || fa fa-user
archives: /archives/ || fa fa-archive
tags: /tags/ || fa fa-tags
categories: /categories/ || fa fa-th
guestbook: /guestbook/ || fas fa-comment-dots
other: # “other”菜单(开始二级菜单),三级菜单以此类推
default: /other/ || fas fa-plus-square # “other”菜单的路径与图标(“default”用来表示“other”)
picture: /picture/ || fas fa-images # 二级菜单内容
schedule: /schedule/ || fa fa-calendar # 注意page文件夹的路径,要放到“default"所代表菜单的文件夹内
sitemap: /sitemap.xml || fa fa-sitemap
#commonweal: /404/ || fa fa-heartbeat

近期文章

将以下代码复制到博客\_data\sidebar.swig

位置:博客\_data\sidebar.swig(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{% if theme.recent_posts %}
<div class="links-of-blogroll motion-element {{ "links-of-blogroll-" + theme.recent_posts_layout }}">
<div class="links-of-blogroll-title">
<!-- modify icon to fire by szw -->
<i class="fa fa-history fa-{{ theme.recent_posts_icon | lower }}" aria-hidden="true"></i>
{{ theme.recent_posts_title }}
</div>
<ul class="links-of-blogroll-list">
{% set posts = site.posts.sort('-date').toArray() %}
{% for post in posts.slice('0', '5') %}
<li>
<a href="{{ url_for(post.path) }}" title="{{ post.title }}" target="_blank">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}

将以下代码复制到博客\_data\next.yml或者主题\_config.yml

位置:博客\_data\next.yml(没有则自建)
1
2
3
4
# 近期文章
recent_posts_title: 近期文章
recent_posts_layout: block
recent_posts: true

主题\_config.yml做出以下修改(开启数据文件)

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  ···
# Define custom file paths.
# Create your custom files in site directory `source/_data` and uncomment needed files below.
# 这里推荐都打开,方便后续修改
custom_file_path:
#head: source/_data/head.swig
#header: source/_data/header.swig
- #sidebar: source/_data/sidebar.swig
+ sidebar: source/_data/sidebar.swig
#postMeta: source/_data/post-meta.swig
#postBodyEnd: source/_data/post-body-end.swig
#footer: source/_data/footer.swig
#bodyEnd: source/_data/body-end.swig
#variable: source/_data/variables.styl
#mixin: source/_data/mixins.styl
#style: source/_data/styles.styl

简繁切换

将以下 js 代码复制到主题\source\js\tw_cn.js文件中

js 代码

位置:主题\source\js\tw_cn.js(自行创建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
var defaultEncoding = 2; // 网站默认语言,1: 繁體中文, 2: 简体中文
var translateDelay = 0; //延迟时间,若不在前, 要设定延迟翻译时间, 如100表示100ms,默认为0
var cookieDomain = "https://ColdCard.wang"; //更改为你的博客网址
var msgToTraditionalChinese = "简体"; //此处可以更改为你想要显示的文字
var msgToSimplifiedChinese = "繁體"; //同上,但两处均不建议更改
var translateButtonId = "translateLink"; //默认互换id
var currentEncoding = defaultEncoding;
var targetEncodingCookie = "targetEncoding" + cookieDomain.replace(/\./g, "");
var targetEncoding = (getCookie(targetEncodingCookie) == null ? defaultEncoding: getCookie(targetEncodingCookie));
var translateButtonObject;
function translateText(txt) {
if (txt == "" || txt == null) return "";
if (currentEncoding == 1 && targetEncoding == 2) return Simplized(txt);
else if (currentEncoding == 2 && targetEncoding == 1) return Traditionalized(txt);
else return txt
}
function translateBody(fobj) {
if (typeof(fobj) == "object") var objs = fobj.childNodes;
else var objs = document.body.childNodes;
for (var i = 0; i < objs.length; i++) {
var obj = objs.item(i);
if ("||BR|HR|TEXTAREA|".indexOf("|" + obj.tagName + "|") > 0 || obj == translateButtonObject) continue;
if (obj.title != "" && obj.title != null) obj.title = translateText(obj.title);
if (obj.alt != "" && obj.alt != null) obj.alt = translateText(obj.alt);
if (obj.tagName == "INPUT" && obj.value != "" && obj.type != "text" && obj.type != "hidden") obj.value = translateText(obj.value);
if (obj.nodeType == 3) obj.data = translateText(obj.data);
else translateBody(obj)
}
}
function translatePage() {
if (targetEncoding == 1) {
currentEncoding = 1;
targetEncoding = 2;
translateButtonObject.innerHTML = msgToTraditionalChinese;
setCookie(targetEncodingCookie, targetEncoding, 7);
translateBody()
} else if (targetEncoding == 2) {
currentEncoding = 2;
targetEncoding = 1;
translateButtonObject.innerHTML = msgToSimplifiedChinese;
setCookie(targetEncodingCookie, targetEncoding, 7);
translateBody()
}
}
function JTPYStr() {
return '万与丑专业丛东丝丢两严丧个丬丰临为丽举么义乌乐乔习乡书买乱争于亏云亘亚产亩亲亵亸亿仅从仑仓仪们价众优伙会伛伞伟传伤伥伦伧伪伫体余佣佥侠侣侥侦侧侨侩侪侬俣俦俨俩俪俭债倾偬偻偾偿傥傧储傩儿兑兖党兰关兴兹养兽冁内冈册写军农冢冯冲决况冻净凄凉凌减凑凛几凤凫凭凯击凼凿刍划刘则刚创删别刬刭刽刿剀剂剐剑剥剧劝办务劢动励劲劳势勋勐勚匀匦匮区医华协单卖卢卤卧卫却卺厂厅历厉压厌厍厕厢厣厦厨厩厮县参叆叇双发变叙叠叶号叹叽吁后吓吕吗吣吨听启吴呒呓呕呖呗员呙呛呜咏咔咙咛咝咤咴咸哌响哑哒哓哔哕哗哙哜哝哟唛唝唠唡唢唣唤唿啧啬啭啮啰啴啸喷喽喾嗫呵嗳嘘嘤嘱噜噼嚣嚯团园囱围囵国图圆圣圹场坂坏块坚坛坜坝坞坟坠垄垅垆垒垦垧垩垫垭垯垱垲垴埘埙埚埝埯堑堕塆墙壮声壳壶壸处备复够头夸夹夺奁奂奋奖奥妆妇妈妩妪妫姗姜娄娅娆娇娈娱娲娴婳婴婵婶媪嫒嫔嫱嬷孙学孪宁宝实宠审宪宫宽宾寝对寻导寿将尔尘尧尴尸尽层屃屉届属屡屦屿岁岂岖岗岘岙岚岛岭岳岽岿峃峄峡峣峤峥峦崂崃崄崭嵘嵚嵛嵝嵴巅巩巯币帅师帏帐帘帜带帧帮帱帻帼幂幞干并广庄庆庐庑库应庙庞废庼廪开异弃张弥弪弯弹强归当录彟彦彻径徕御忆忏忧忾怀态怂怃怄怅怆怜总怼怿恋恳恶恸恹恺恻恼恽悦悫悬悭悯惊惧惨惩惫惬惭惮惯愍愠愤愦愿慑慭憷懑懒懔戆戋戏戗战戬户扎扑扦执扩扪扫扬扰抚抛抟抠抡抢护报担拟拢拣拥拦拧拨择挂挚挛挜挝挞挟挠挡挢挣挤挥挦捞损捡换捣据捻掳掴掷掸掺掼揸揽揿搀搁搂搅携摄摅摆摇摈摊撄撑撵撷撸撺擞攒敌敛数斋斓斗斩断无旧时旷旸昙昼昽显晋晒晓晔晕晖暂暧札术朴机杀杂权条来杨杩杰极构枞枢枣枥枧枨枪枫枭柜柠柽栀栅标栈栉栊栋栌栎栏树栖样栾桊桠桡桢档桤桥桦桧桨桩梦梼梾检棂椁椟椠椤椭楼榄榇榈榉槚槛槟槠横樯樱橥橱橹橼檐檩欢欤欧歼殁殇残殒殓殚殡殴毁毂毕毙毡毵氇气氢氩氲汇汉污汤汹沓沟没沣沤沥沦沧沨沩沪沵泞泪泶泷泸泺泻泼泽泾洁洒洼浃浅浆浇浈浉浊测浍济浏浐浑浒浓浔浕涂涌涛涝涞涟涠涡涢涣涤润涧涨涩淀渊渌渍渎渐渑渔渖渗温游湾湿溃溅溆溇滗滚滞滟滠满滢滤滥滦滨滩滪漤潆潇潋潍潜潴澜濑濒灏灭灯灵灾灿炀炉炖炜炝点炼炽烁烂烃烛烟烦烧烨烩烫烬热焕焖焘煅煳熘爱爷牍牦牵牺犊犟状犷犸犹狈狍狝狞独狭狮狯狰狱狲猃猎猕猡猪猫猬献獭玑玙玚玛玮环现玱玺珉珏珐珑珰珲琎琏琐琼瑶瑷璇璎瓒瓮瓯电画畅畲畴疖疗疟疠疡疬疮疯疱疴痈痉痒痖痨痪痫痴瘅瘆瘗瘘瘪瘫瘾瘿癞癣癫癯皑皱皲盏盐监盖盗盘眍眦眬着睁睐睑瞒瞩矫矶矾矿砀码砖砗砚砜砺砻砾础硁硅硕硖硗硙硚确硷碍碛碜碱碹磙礼祎祢祯祷祸禀禄禅离秃秆种积称秽秾稆税稣稳穑穷窃窍窑窜窝窥窦窭竖竞笃笋笔笕笺笼笾筑筚筛筜筝筹签简箓箦箧箨箩箪箫篑篓篮篱簖籁籴类籼粜粝粤粪粮糁糇紧絷纟纠纡红纣纤纥约级纨纩纪纫纬纭纮纯纰纱纲纳纴纵纶纷纸纹纺纻纼纽纾线绀绁绂练组绅细织终绉绊绋绌绍绎经绐绑绒结绔绕绖绗绘给绚绛络绝绞统绠绡绢绣绤绥绦继绨绩绪绫绬续绮绯绰绱绲绳维绵绶绷绸绹绺绻综绽绾绿缀缁缂缃缄缅缆缇缈缉缊缋缌缍缎缏缐缑缒缓缔缕编缗缘缙缚缛缜缝缞缟缠缡缢缣缤缥缦缧缨缩缪缫缬缭缮缯缰缱缲缳缴缵罂网罗罚罢罴羁羟羡翘翙翚耢耧耸耻聂聋职聍联聩聪肃肠肤肷肾肿胀胁胆胜胧胨胪胫胶脉脍脏脐脑脓脔脚脱脶脸腊腌腘腭腻腼腽腾膑臜舆舣舰舱舻艰艳艹艺节芈芗芜芦苁苇苈苋苌苍苎苏苘苹茎茏茑茔茕茧荆荐荙荚荛荜荞荟荠荡荣荤荥荦荧荨荩荪荫荬荭荮药莅莜莱莲莳莴莶获莸莹莺莼萚萝萤营萦萧萨葱蒇蒉蒋蒌蓝蓟蓠蓣蓥蓦蔷蔹蔺蔼蕲蕴薮藁藓虏虑虚虫虬虮虽虾虿蚀蚁蚂蚕蚝蚬蛊蛎蛏蛮蛰蛱蛲蛳蛴蜕蜗蜡蝇蝈蝉蝎蝼蝾螀螨蟏衅衔补衬衮袄袅袆袜袭袯装裆裈裢裣裤裥褛褴襁襕见观觃规觅视觇览觉觊觋觌觍觎觏觐觑觞触觯詟誉誊讠计订讣认讥讦讧讨让讪讫训议讯记讱讲讳讴讵讶讷许讹论讻讼讽设访诀证诂诃评诅识诇诈诉诊诋诌词诎诏诐译诒诓诔试诖诗诘诙诚诛诜话诞诟诠诡询诣诤该详诧诨诩诪诫诬语诮误诰诱诲诳说诵诶请诸诹诺读诼诽课诿谀谁谂调谄谅谆谇谈谊谋谌谍谎谏谐谑谒谓谔谕谖谗谘谙谚谛谜谝谞谟谠谡谢谣谤谥谦谧谨谩谪谫谬谭谮谯谰谱谲谳谴谵谶谷豮贝贞负贠贡财责贤败账货质贩贪贫贬购贮贯贰贱贲贳贴贵贶贷贸费贺贻贼贽贾贿赀赁赂赃资赅赆赇赈赉赊赋赌赍赎赏赐赑赒赓赔赕赖赗赘赙赚赛赜赝赞赟赠赡赢赣赪赵赶趋趱趸跃跄跖跞践跶跷跸跹跻踊踌踪踬踯蹑蹒蹰蹿躏躜躯车轧轨轩轪轫转轭轮软轰轱轲轳轴轵轶轷轸轹轺轻轼载轾轿辀辁辂较辄辅辆辇辈辉辊辋辌辍辎辏辐辑辒输辔辕辖辗辘辙辚辞辩辫边辽达迁过迈运还这进远违连迟迩迳迹适选逊递逦逻遗遥邓邝邬邮邹邺邻郁郄郏郐郑郓郦郧郸酝酦酱酽酾酿释里鉅鉴銮錾钆钇针钉钊钋钌钍钎钏钐钑钒钓钔钕钖钗钘钙钚钛钝钞钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀铁铂铃铄铅铆铈铉铊铋铍铎铏铐铑铒铕铗铘铙铚铛铜铝铞铟铠铡铢铣铤铥铦铧铨铪铫铬铭铮铯铰铱铲铳铴铵银铷铸铹铺铻铼铽链铿销锁锂锃锄锅锆锇锈锉锊锋锌锍锎锏锐锑锒锓锔锕锖锗错锚锜锞锟锠锡锢锣锤锥锦锨锩锫锬锭键锯锰锱锲锳锴锵锶锷锸锹锺锻锼锽锾锿镀镁镂镃镆镇镈镉镊镌镍镎镏镐镑镒镕镖镗镙镚镛镜镝镞镟镠镡镢镣镤镥镦镧镨镩镪镫镬镭镮镯镰镱镲镳镴镶长门闩闪闫闬闭问闯闰闱闲闳间闵闶闷闸闹闺闻闼闽闾闿阀阁阂阃阄阅阆阇阈阉阊阋阌阍阎阏阐阑阒阓阔阕阖阗阘阙阚阛队阳阴阵阶际陆陇陈陉陕陧陨险随隐隶隽难雏雠雳雾霁霉霭靓静靥鞑鞒鞯鞴韦韧韨韩韪韫韬韵页顶顷顸项顺须顼顽顾顿颀颁颂颃预颅领颇颈颉颊颋颌颍颎颏颐频颒颓颔颕颖颗题颙颚颛颜额颞颟颠颡颢颣颤颥颦颧风飏飐飑飒飓飔飕飖飗飘飙飚飞飨餍饤饥饦饧饨饩饪饫饬饭饮饯饰饱饲饳饴饵饶饷饸饹饺饻饼饽饾饿馀馁馂馃馄馅馆馇馈馉馊馋馌馍馎馏馐馑馒馓馔馕马驭驮驯驰驱驲驳驴驵驶驷驸驹驺驻驼驽驾驿骀骁骂骃骄骅骆骇骈骉骊骋验骍骎骏骐骑骒骓骔骕骖骗骘骙骚骛骜骝骞骟骠骡骢骣骤骥骦骧髅髋髌鬓魇魉鱼鱽鱾鱿鲀鲁鲂鲄鲅鲆鲇鲈鲉鲊鲋鲌鲍鲎鲏鲐鲑鲒鲓鲔鲕鲖鲗鲘鲙鲚鲛鲜鲝鲞鲟鲠鲡鲢鲣鲤鲥鲦鲧鲨鲩鲪鲫鲬鲭鲮鲯鲰鲱鲲鲳鲴鲵鲶鲷鲸鲹鲺鲻鲼鲽鲾鲿鳀鳁鳂鳃鳄鳅鳆鳇鳈鳉鳊鳋鳌鳍鳎鳏鳐鳑鳒鳓鳔鳕鳖鳗鳘鳙鳛鳜鳝鳞鳟鳠鳡鳢鳣鸟鸠鸡鸢鸣鸤鸥鸦鸧鸨鸩鸪鸫鸬鸭鸮鸯鸰鸱鸲鸳鸴鸵鸶鸷鸸鸹鸺鸻鸼鸽鸾鸿鹀鹁鹂鹃鹄鹅鹆鹇鹈鹉鹊鹋鹌鹍鹎鹏鹐鹑鹒鹓鹔鹕鹖鹗鹘鹚鹛鹜鹝鹞鹟鹠鹡鹢鹣鹤鹥鹦鹧鹨鹩鹪鹫鹬鹭鹯鹰鹱鹲鹳鹴鹾麦麸黄黉黡黩黪黾鼋鼌鼍鼗鼹齄齐齑齿龀龁龂龃龄龅龆龇龈龉龊龋龌龙龚龛龟志制咨只里系范松没尝尝闹面准钟别闲干尽脏拼'
}
function FTPYStr() {
return '萬與醜專業叢東絲丟兩嚴喪個爿豐臨為麗舉麼義烏樂喬習鄉書買亂爭於虧雲亙亞產畝親褻嚲億僅從侖倉儀們價眾優夥會傴傘偉傳傷倀倫傖偽佇體餘傭僉俠侶僥偵側僑儈儕儂俁儔儼倆儷儉債傾傯僂僨償儻儐儲儺兒兌兗黨蘭關興茲養獸囅內岡冊寫軍農塚馮衝決況凍淨淒涼淩減湊凜幾鳳鳧憑凱擊氹鑿芻劃劉則剛創刪別剗剄劊劌剴劑剮劍剝劇勸辦務勱動勵勁勞勢勳猛勩勻匭匱區醫華協單賣盧鹵臥衛卻巹廠廳曆厲壓厭厙廁廂厴廈廚廄廝縣參靉靆雙發變敘疊葉號歎嘰籲後嚇呂嗎唚噸聽啟吳嘸囈嘔嚦唄員咼嗆嗚詠哢嚨嚀噝吒噅鹹呱響啞噠嘵嗶噦嘩噲嚌噥喲嘜嗊嘮啢嗩唕喚呼嘖嗇囀齧囉嘽嘯噴嘍嚳囁嗬噯噓嚶囑嚕劈囂謔團園囪圍圇國圖圓聖壙場阪壞塊堅壇壢壩塢墳墜壟壟壚壘墾坰堊墊埡墶壋塏堖塒塤堝墊垵塹墮壪牆壯聲殼壺壼處備複夠頭誇夾奪奩奐奮獎奧妝婦媽嫵嫗媯姍薑婁婭嬈嬌孌娛媧嫻嫿嬰嬋嬸媼嬡嬪嬙嬤孫學孿寧寶實寵審憲宮寬賓寢對尋導壽將爾塵堯尷屍盡層屭屜屆屬屢屨嶼歲豈嶇崗峴嶴嵐島嶺嶽崠巋嶨嶧峽嶢嶠崢巒嶗崍嶮嶄嶸嶔崳嶁脊巔鞏巰幣帥師幃帳簾幟帶幀幫幬幘幗冪襆幹並廣莊慶廬廡庫應廟龐廢廎廩開異棄張彌弳彎彈強歸當錄彠彥徹徑徠禦憶懺憂愾懷態慫憮慪悵愴憐總懟懌戀懇惡慟懨愷惻惱惲悅愨懸慳憫驚懼慘懲憊愜慚憚慣湣慍憤憒願懾憖怵懣懶懍戇戔戲戧戰戩戶紮撲扡執擴捫掃揚擾撫拋摶摳掄搶護報擔擬攏揀擁攔擰撥擇掛摯攣掗撾撻挾撓擋撟掙擠揮撏撈損撿換搗據撚擄摑擲撣摻摜摣攬撳攙擱摟攪攜攝攄擺搖擯攤攖撐攆擷擼攛擻攢敵斂數齋斕鬥斬斷無舊時曠暘曇晝曨顯晉曬曉曄暈暉暫曖劄術樸機殺雜權條來楊榪傑極構樅樞棗櫪梘棖槍楓梟櫃檸檉梔柵標棧櫛櫳棟櫨櫟欄樹棲樣欒棬椏橈楨檔榿橋樺檜槳樁夢檮棶檢欞槨櫝槧欏橢樓欖櫬櫚櫸檟檻檳櫧橫檣櫻櫫櫥櫓櫞簷檁歡歟歐殲歿殤殘殞殮殫殯毆毀轂畢斃氈毿氌氣氫氬氳彙漢汙湯洶遝溝沒灃漚瀝淪滄渢溈滬濔濘淚澩瀧瀘濼瀉潑澤涇潔灑窪浹淺漿澆湞溮濁測澮濟瀏滻渾滸濃潯濜塗湧濤澇淶漣潿渦溳渙滌潤澗漲澀澱淵淥漬瀆漸澠漁瀋滲溫遊灣濕潰濺漵漊潷滾滯灩灄滿瀅濾濫灤濱灘澦濫瀠瀟瀲濰潛瀦瀾瀨瀕灝滅燈靈災燦煬爐燉煒熗點煉熾爍爛烴燭煙煩燒燁燴燙燼熱煥燜燾煆糊溜愛爺牘犛牽犧犢強狀獷獁猶狽麅獮獰獨狹獅獪猙獄猻獫獵獼玀豬貓蝟獻獺璣璵瑒瑪瑋環現瑲璽瑉玨琺瓏璫琿璡璉瑣瓊瑤璦璿瓔瓚甕甌電畫暢佘疇癤療瘧癘瘍鬁瘡瘋皰屙癰痙癢瘂癆瘓癇癡癉瘮瘞瘺癟癱癮癭癩癬癲臒皚皺皸盞鹽監蓋盜盤瞘眥矓著睜睞瞼瞞矚矯磯礬礦碭碼磚硨硯碸礪礱礫礎硜矽碩硤磽磑礄確鹼礙磧磣堿镟滾禮禕禰禎禱禍稟祿禪離禿稈種積稱穢穠穭稅穌穩穡窮竊竅窯竄窩窺竇窶豎競篤筍筆筧箋籠籩築篳篩簹箏籌簽簡籙簀篋籜籮簞簫簣簍籃籬籪籟糴類秈糶糲粵糞糧糝餱緊縶糸糾紆紅紂纖紇約級紈纊紀紉緯紜紘純紕紗綱納紝縱綸紛紙紋紡紵紖紐紓線紺絏紱練組紳細織終縐絆紼絀紹繹經紿綁絨結絝繞絰絎繪給絢絳絡絕絞統綆綃絹繡綌綏絛繼綈績緒綾緓續綺緋綽緔緄繩維綿綬繃綢綯綹綣綜綻綰綠綴緇緙緗緘緬纜緹緲緝縕繢緦綞緞緶線緱縋緩締縷編緡緣縉縛縟縝縫縗縞纏縭縊縑繽縹縵縲纓縮繆繅纈繚繕繒韁繾繰繯繳纘罌網羅罰罷羆羈羥羨翹翽翬耮耬聳恥聶聾職聹聯聵聰肅腸膚膁腎腫脹脅膽勝朧腖臚脛膠脈膾髒臍腦膿臠腳脫腡臉臘醃膕齶膩靦膃騰臏臢輿艤艦艙艫艱豔艸藝節羋薌蕪蘆蓯葦藶莧萇蒼苧蘇檾蘋莖蘢蔦塋煢繭荊薦薘莢蕘蓽蕎薈薺蕩榮葷滎犖熒蕁藎蓀蔭蕒葒葤藥蒞蓧萊蓮蒔萵薟獲蕕瑩鶯蓴蘀蘿螢營縈蕭薩蔥蕆蕢蔣蔞藍薊蘺蕷鎣驀薔蘞藺藹蘄蘊藪槁蘚虜慮虛蟲虯蟣雖蝦蠆蝕蟻螞蠶蠔蜆蠱蠣蟶蠻蟄蛺蟯螄蠐蛻蝸蠟蠅蟈蟬蠍螻蠑螿蟎蠨釁銜補襯袞襖嫋褘襪襲襏裝襠褌褳襝褲襇褸襤繈襴見觀覎規覓視覘覽覺覬覡覿覥覦覯覲覷觴觸觶讋譽謄訁計訂訃認譏訐訌討讓訕訖訓議訊記訒講諱謳詎訝訥許訛論訩訟諷設訪訣證詁訶評詛識詗詐訴診詆謅詞詘詔詖譯詒誆誄試詿詩詰詼誠誅詵話誕詬詮詭詢詣諍該詳詫諢詡譸誡誣語誚誤誥誘誨誑說誦誒請諸諏諾讀諑誹課諉諛誰諗調諂諒諄誶談誼謀諶諜謊諫諧謔謁謂諤諭諼讒諮諳諺諦謎諞諝謨讜謖謝謠謗諡謙謐謹謾謫譾謬譚譖譙讕譜譎讞譴譫讖穀豶貝貞負貟貢財責賢敗賬貨質販貪貧貶購貯貫貳賤賁貰貼貴貺貸貿費賀貽賊贄賈賄貲賃賂贓資賅贐賕賑賚賒賦賭齎贖賞賜贔賙賡賠賧賴賵贅賻賺賽賾贗讚贇贈贍贏贛赬趙趕趨趲躉躍蹌蹠躒踐躂蹺蹕躚躋踴躊蹤躓躑躡蹣躕躥躪躦軀車軋軌軒軑軔轉軛輪軟轟軲軻轤軸軹軼軤軫轢軺輕軾載輊轎輈輇輅較輒輔輛輦輩輝輥輞輬輟輜輳輻輯轀輸轡轅轄輾轆轍轔辭辯辮邊遼達遷過邁運還這進遠違連遲邇逕跡適選遜遞邐邏遺遙鄧鄺鄔郵鄒鄴鄰鬱郤郟鄶鄭鄆酈鄖鄲醞醱醬釅釃釀釋裏钜鑒鑾鏨釓釔針釘釗釙釕釷釺釧釤鈒釩釣鍆釹鍚釵鈃鈣鈈鈦鈍鈔鍾鈉鋇鋼鈑鈐鑰欽鈞鎢鉤鈧鈁鈥鈄鈕鈀鈺錢鉦鉗鈷缽鈳鉕鈽鈸鉞鑽鉬鉭鉀鈿鈾鐵鉑鈴鑠鉛鉚鈰鉉鉈鉍鈹鐸鉶銬銠鉺銪鋏鋣鐃銍鐺銅鋁銱銦鎧鍘銖銑鋌銩銛鏵銓鉿銚鉻銘錚銫鉸銥鏟銃鐋銨銀銣鑄鐒鋪鋙錸鋱鏈鏗銷鎖鋰鋥鋤鍋鋯鋨鏽銼鋝鋒鋅鋶鐦鐧銳銻鋃鋟鋦錒錆鍺錯錨錡錁錕錩錫錮鑼錘錐錦鍁錈錇錟錠鍵鋸錳錙鍥鍈鍇鏘鍶鍔鍤鍬鍾鍛鎪鍠鍰鎄鍍鎂鏤鎡鏌鎮鎛鎘鑷鐫鎳鎿鎦鎬鎊鎰鎔鏢鏜鏍鏰鏞鏡鏑鏃鏇鏐鐔钁鐐鏷鑥鐓鑭鐠鑹鏹鐙鑊鐳鐶鐲鐮鐿鑔鑣鑞鑲長門閂閃閆閈閉問闖閏闈閑閎間閔閌悶閘鬧閨聞闥閩閭闓閥閣閡閫鬮閱閬闍閾閹閶鬩閿閽閻閼闡闌闃闠闊闋闔闐闒闕闞闤隊陽陰陣階際陸隴陳陘陝隉隕險隨隱隸雋難雛讎靂霧霽黴靄靚靜靨韃鞽韉韝韋韌韍韓韙韞韜韻頁頂頃頇項順須頊頑顧頓頎頒頌頏預顱領頗頸頡頰頲頜潁熲頦頤頻頮頹頷頴穎顆題顒顎顓顏額顳顢顛顙顥纇顫顬顰顴風颺颭颮颯颶颸颼颻飀飄飆飆飛饗饜飣饑飥餳飩餼飪飫飭飯飲餞飾飽飼飿飴餌饒餉餄餎餃餏餅餑餖餓餘餒餕餜餛餡館餷饋餶餿饞饁饃餺餾饈饉饅饊饌饢馬馭馱馴馳驅馹駁驢駔駛駟駙駒騶駐駝駑駕驛駘驍罵駰驕驊駱駭駢驫驪騁驗騂駸駿騏騎騍騅騌驌驂騙騭騤騷騖驁騮騫騸驃騾驄驏驟驥驦驤髏髖髕鬢魘魎魚魛魢魷魨魯魴魺鮁鮃鯰鱸鮋鮓鮒鮊鮑鱟鮍鮐鮭鮚鮳鮪鮞鮦鰂鮜鱠鱭鮫鮮鮺鯗鱘鯁鱺鰱鰹鯉鰣鰷鯀鯊鯇鮶鯽鯒鯖鯪鯕鯫鯡鯤鯧鯝鯢鯰鯛鯨鯵鯴鯔鱝鰈鰏鱨鯷鰮鰃鰓鱷鰍鰒鰉鰁鱂鯿鰠鼇鰭鰨鰥鰩鰟鰜鰳鰾鱈鱉鰻鰵鱅鰼鱖鱔鱗鱒鱯鱤鱧鱣鳥鳩雞鳶鳴鳲鷗鴉鶬鴇鴆鴣鶇鸕鴨鴞鴦鴒鴟鴝鴛鴬鴕鷥鷙鴯鴰鵂鴴鵃鴿鸞鴻鵐鵓鸝鵑鵠鵝鵒鷳鵜鵡鵲鶓鵪鶤鵯鵬鵮鶉鶊鵷鷫鶘鶡鶚鶻鶿鶥鶩鷊鷂鶲鶹鶺鷁鶼鶴鷖鸚鷓鷚鷯鷦鷲鷸鷺鸇鷹鸌鸏鸛鸘鹺麥麩黃黌黶黷黲黽黿鼂鼉鞀鼴齇齊齏齒齔齕齗齟齡齙齠齜齦齬齪齲齷龍龔龕龜誌製谘隻裡係範鬆冇嚐嘗鬨麵準鐘彆閒乾儘臟拚'
}
function Traditionalized(cc) {
var str = '';
var ss = JTPYStr();
var tt = FTPYStr();
for (var i = 0; i < cc.length; i++) {
if (cc.charCodeAt(i) > 10000 && ss.indexOf(cc.charAt(i)) != -1) str += tt.charAt(ss.indexOf(cc.charAt(i)));
else str += cc.charAt(i)
}
return str
}
function Simplized(cc) {
var str = '';
var ss = JTPYStr();
var tt = FTPYStr();
for (var i = 0; i < cc.length; i++) {
if (cc.charCodeAt(i) > 10000 && tt.indexOf(cc.charAt(i)) != -1) str += ss.charAt(tt.indexOf(cc.charAt(i)));
else str += cc.charAt(i)
}
return str
}
function setCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString()
} else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/"
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length)
}
return null
}
function translateInitilization() {
translateButtonObject = document.getElementById(translateButtonId);
if (translateButtonObject) {
with(translateButtonObject) {
if (typeof(document.all) != "object") {
href = "javascript:translatePage();"
} else {
href = "#";
onclick = new Function("translatePage(); return false;")
}
}
if (currentEncoding != targetEncoding) {
setTimeout("translateBody()", translateDelay);
if (targetEncoding == 1) translateButtonObject.innerHTML = msgToSimplifiedChinese;
else translateButtonObject.innerHTML = msgToTraditionalChinese
}
}
}

将以下内容复制到你想要放置切换开关的地方(我放到了脚页footer.swig中)

位置:博客\_data\footer.swig(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div class="translate-style">
当前中文字体:<a id="translateLink" href="javascript:translatePage();">简体
</a>
</div>
<script type="text/javascript" src="/js/tw_cn.js"></script>
<script type="text/javascript">
var defaultEncoding = 2; //网站编写字体是否繁体,1-繁体,2-简体
var translateDelay = 0; //延迟时间,若不在前, 要设定延迟翻译时间, 如100表示100ms,默认为0
var cookieDomain = "https://ColdCard.wang/"; //Cookie地址, 一定要设定, 通常为你的网址
var msgToTraditionalChinese = "简体"; //此处可以更改为你想要显示的文字
var msgToSimplifiedChinese = "繁體"; //同上,但两处均不建议更改
var translateButtonId = "translateLink"; //默认互换id
translateInitilization();
</script>

脚注 hexo-reference

Markdown 基本语法中并不包含脚注语法,但是脚注作为一种常见的文本格式,对于文字编辑工作者,特别是喜欢插入引文的人而言,有着很大的使用需求。所以 Multi-Markdown 在其扩充语法集中增添了脚注的语法。大部分的 Markdown 编辑器现在都采用了该语法来渲染脚注。但 Hexo 的默认渲染器是不支持脚注语法的。
所以本博客使用 hexo-reference 插件实现脚注功能。

  • 本博客脚注样式

    位置:博客\source\_data\styles.styl(没有则自建)
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    //脚注
    .hint--error:after {
    background-color: #917bb8 !important;
    text-shadow: 0 1px 3px #000000 !important;
    }
    .hint--error.hint--top-left:before, .hint--error.hint--top-right:before, .hint--error.hint--top:before {
    border-top-color: #917bb8 !important;
    }
    #footnotelist {
    font-weight: 300 !important;
    }

页面宽度修改

位置:博客\source\_data\variables.styl(没有则自建)
1
2
3
$content-desktop                = 60em;
$content-desktop-large = 70em;
$content-desktop-largest = 93em;

部署到 Coding 国内外分流

设置

位置:博客\_config.yml
1
2
3
4
5
6
7
8
9
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
- type: git
repo: https://github.com/Cold-Card/Cold-Card.github.io.git
branch: master
- type: git
repo: git@e.coding.net:Cold-Card/ColdCard.coding.me.git
branch: master

解析[9]

效果还是挺明显的

暗、亮

本博客已支持 亮/暗 样式切换,可根据“系统亮暗主题”或“浏览器亮暗主题”自动切换(其实还想加个手动切换,但是至今没找到合适的方法)。
位置:主题\_config.yml
1
2
# Dark Mode
darkmode: true

自定义样式可参考本博客的styles.styl

Github 贡献图

所用到的 Github Chart API

徽章

徽章是一种小巧精美的小图标,一般配有相关文字进行辅助说明,富有表现力。
类似文章开头和脚页上的徽章图片。
本博客使用的徽章生成网站 shields.io ,这也是 Github 使用的徽章网站。

PJAX

该项功能的作用是:跳转到同网站另一个页面的时候,前后两个页面相同的元素不再重复加载,进而节省了加载的时间,加快访问速度。
开启 PJAX 后或多或少会出现出现浏览上的 BUG,特别是一些使用 JavaScript 的地方。我没有深入研究过该项功能的原理,所以也无法修复一些出现的 BUG。

位置:主题\_config.yml
1
2
3
4
5
6
7
# Easily enable fast Ajax navigation on your website.
# Dependencies: https://github.com/theme-next/theme-next-pjax
pjax: true

# Internal shields: 0.2.8
# pjax: //cdn.jsdelivr.net/gh/theme-next/theme-next-pjax@0/pjax.min.js
pjax: //cdn.jsdelivr.net/gh/theme-next/theme-next-pjax@0/pjax.min.js
本博客上的 BUG:折叠功能的反复开折(已修复)、新页面上的 AddThis 以及 Star rating(星级评价)不加载(上述 BUG 都可刷新页面解决)。

博客备份

需要备份的文件及文件夹:scaffoldings[2] source[3] themes[4] .gitignore[5] _config.yml[6] gulpfile.js[7] package.json[8]

Git 命令

1
2
3
4
5
6
7
8
git clone ... # 克隆仓库
git add . # 添加所有文件变化
git commit -m "备份" # 上传说明
git remote add origin # 设置远程仓库地址
git push origin master # 将本地主分支推到远程分支
git push -f origin master # 将本地主分支强推到远程分支
git remote rm origin # 删除本地库与远程库的关联
git init # 初始化

备份到 Github

已备份到 Github 的 BackUp 仓库

备份到 Coding

已备份到 Coding 的 Hexo 仓库

谷歌日历

NexT 主题为schedule页面添加了index功能,使用 Google Calendar API 实现日程显示,正好我也经常在 Google Calendar 上记录日程、课程表之类的,所以就设置了一下。

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
# Google Calendar
# Share your recent schedule to others via calendar page.
calendar:
calendar_id: # Your Google account E-Mail
api_key:
orderBy: startTime
offsetMax: 24 # Time Range
offsetMin: 4 # Time Range
showDeleted: false #是否显示已删除日程
singleEvents: true
showLocation: true #是否显示地点
maxResults: 250
  • 方法

    首先打开 Google Developer Console 的 API 和服务,需要科学上网,登录自己的 Google 账号

    新建一个 Project(项目)

    然后点击启用 API 和服务,在里面搜索 Calendar ,启用 API

    启用后回到刚刚的 Google Developer Console 的 API 和服务界面,左侧点击凭据,创建凭据,选择 API 密钥之后,会自动创建一个 API 密钥

    名称:随意
    应用限制:HTTP引荐来源网址(网站)
    网站限制:博客日程页面网址,最好也加上http://localhost:4000/other/schedule/本地网址(方便调试)
    API 限制:随意

    得到 API Key 复制到_config.yml

    谷歌日历设置中找到你想要显示的日历的“日历 ID”calendar_id(一般是谷歌账号邮箱)复制到_config.yml

    勾选公开此日历

本博客谷歌日历样式

位置:博客\source\_data\styles.styl(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//日程
.event-list hr::after, .event-list hr, .event-list .event, .event-list .event .event-details, .event-list .event .event-details::before, .event-list .event .event-summary {
transition: color 1s ease-in-out,background 1s ease-in-out,margin 0.2s ease-in-out;
}
.event-list hr::after {
content: '未来一周';
}
.event-list hr {
&::after {
box-shadow: 0px 0 13px 3px rgba(0,0,0,0.3);
}
}
.event-list .event {
box-shadow: 0px 0 13px 3px rgba(0,0,0,0.3);
&:hover {
margin: 20px -12px
}
.event-details {
padding-top: 6px
}
}
@media (prefers-color-scheme: light)
.event-list hr {
background: #fff;
&::after {
background: #fff;
color: #3f3f3f
}
}
.event-list .event {
background: #fff;
//标题
.event-summary {
color: #727272
&::before {
color: #727272
}
}
//详情
.event-details {
color: #727272
&::before {
color: #828282
}
}
//时间
.event-relative-time {
color: #b1b1b1
}
}
//现在
.event-list .event-now {
//标题
.event-summary {
color: #b189dd
&::before {
color: #b189dd
}
}
//详情
.event-details {
color: #b189dd
&::before {
color: #b189dd
}
}
//时间
.event-relative-time {
color: #b189dd
}

}
//上一个
.event-list .event-past {
//标题
.event-summary {
opacity: 0.5;
&::before {
opacity: 0.5;
}
}
//详情
.event-details {
opacity: 0.5;
}
}
@media (prefers-color-scheme: dark)
.event-list hr {
background: #222;
&::after {
background: #222;
}
}
.event-list .event {
background: #222;
//标题
.event-summary {
color: #c9c9c9;
}
//详情
.event-details {
color: #ababab
&::before {
color: #ccc
}
}
//时间
.event-relative-time {
color: #6b6b6b
}
}
//现在
.event-list .event-now {
//标题
.event-summary {
color: #fff;
&::before {
color: #b189dd
}
}
//详情
.event-details {
color: #c9c9c9;
&::before {
color: #b189dd
}
}
//时间
.event-relative-time {
color: #b189dd
}

}
//上一个
.event-list .event-past {
//标题
.event-summary {
opacity: 0.5;
&::before {
opacity: 0.5;
}
}
//详情
.event-details {
opacity: 0.5;
}
}

BiliBili 追番列表

Hexo-bilibili-bangumi

将下面的配置写入站点的配置文件_config.yml里 (不是主题的配置文件)

位置:博客\_config.yml
1
2
3
4
5
6
7
8
bangumi:
enable: true
path: # 番剧页面路径,默认 bangumis/index.html
vmid: # 哔哩哔哩番剧页面的 uid (登录哔哩哔哩后前往 https://space.bilibili.com/ 页面,网址最后的一串数字)
title: '追番列表' # 该页面的标题
quote: '生命不息,追番不止!' # 写在页面开头的一段话,支持 html 语法
show: 1 # 初始显示页面:0: 想看 , 1: 在看 , 2: 看过,默认为 1
loading: # 图片加载完成前的 loading 图片
  • 需要将追番列表设置为公开
  • hexo generatehexo deploy之前使用hexo bangumi -u命令更新番剧数据
  • 删除数据hexo bangumi -d

本博客追番列表

本博客追番列表样式

位置:博客\source\_data\styles.styl(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//追番
.bangumi-active {
background: #686868 !important;
font-weight: bold !important;
&:hover {
color: #fff !important;
}
}
.bangumi-item {
border: none !important;
&:hover {
transform: scale(1.03);
}
}
.bangumi-title {
font-weight: bold !important;
}
.bangumi-info-items {
color: #827bbf !important;
padding-bottom: 10px !important;
}
.bangumi-info-item {
border-right: 2px solid #cccccc !important;
}
.bangumi-info-item-score {
color: #cc4747 !important;
border-right: 1px solid #0000 !important;
}
.bangumi-info-total {
color: #cc4747 !important;
}
.bangumi-comments {
line-height: 2.3
}
.bangumi-button:hover {
background: #686868 !important;
color: #fff !important;
font-weight: bold !important;
}

添加阿里图标

  • 打开 iconfont

  • 选择图标,添加入库

  • 选择Font class,生成 css 链接

  • 可以下载到本地,也可以链接引入(本博客使用后者)

  • 引入 css 样式

    位置:博客\source\_data\head.swig(没有则自建)
    1
    <link rel="stylesheet" href="https:生成的 css 链接">
  • 使用

    1
    2
    3
    4
    5
    // 与 Font Awesome 格式一样

    <i class="iconfont icon-图标名"></i>

    *** || iconfont icon-图标名

Steam 游戏标签

Hexo-tag-steamgame

  • 使用方法

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    {# 单个插入 #}
    {% steamgame appid description %}

    {# 批量插入 #}
    {% steamgames %}
    appid
    appid
    appid
    ···
    appid
    appid
    appid
    {% endsteamgames %}

    {# appid: Steam 游戏 appid #}
    {# description(可选): 用于替换默认游戏简介 #}

升级内容(较前版本)

置顶

原博客采用插件hexo-generator-index-pin-top,但要使用此插件就要将原本的hexo-generator-index插件卸载,这次升级,我发现原来的插件就有置顶功能,只是此置顶功能只能在文章标题前加一个图标,并不能置顶。
所以要实现置顶功能,就要修改以下内容

位置:博客\node_modules\hexo-generator-index\lib\generator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';

var pagination = require('hexo-pagination');

module.exports = function(locals) {
var config = this.config;
var posts = locals.posts

var order_by = config.index_generator.order_by.slice(1)

posts.data = posts.data.sort(function(a, b) {
if(a.sticky && b.sticky) {
if(a.sticky == b.sticky) return b[order_by] - a[order_by];
else return b.sticky - a.sticky;
}
else if(a.sticky && !b.sticky) {
return -1;
}
else if(!a.sticky && b.sticky) {
return 1;
}
else return b[order_by] - a[order_by];
});

var paginationDir = config.pagination_dir || 'page';
var path = config.index_generator.path || '';

return pagination(path, posts, {
perPage: config.index_generator.per_page,
layout: ['index', 'archive'],
format: paginationDir + '/%d/',
data: {
__index: true
}
});
};

分享

AddThis

位置:主题\_config.yml
1
2
3
# AddThis Share. See: https://www.addthis.com
# Go to https://www.addthis.com/dashboard to customize your tools.
add_this_id:

本博客 AddThis 样式

位置:博客\source\_data\styles.styl(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//addthis
.atss .at-share-btn .at-icon-wrapper {
transition-property: color,background;
transition-delay: 0s;
transition-duration: 1s;
transition-timing-function: ease-in-out;
}
#at4-share, #at4-soc {
box-shadow: 0 0 13px 3px rgba(0,0,0,0.5)
}
.atss .at-share-btn {
&:hover {
box-shadow: 0 0 13px 3px rgba(0,0,0,0.5)
}
}
@media (prefers-color-scheme: light)
.atss .at-share-btn .at-icon-wrapper {
background-color: #ffffff !important;
}

字体

Google Fonts 分别在 11 月 18 日和 12 月 07 日提供了思源黑体和思源宋体的简繁支持,而且高达 6 种字重支持,其中思源宋体更是高达 7 种字重。对于中文书籍,宋体一直是正文印刷的标准字体,而不是目前电子显示屏上普遍的黑体,因为宋体的衬线更适合长时间阅读。
所以我将文本字体设为思源宋体Noto Serif SC,而代码字体设为Source Code Pro,因为想加点花样,所以将全局字体设为ZCOOL KuaiLe

位置:主题\_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
font:
enable: true

# Uri of fonts host, e.g. https://fonts.googleapis.com (Default).
host: https://fonts.loli.net

# Font options:
# `external: true` will load this font family from `host` above.
# `family: Times New Roman`. Without any quotes.
# `size: x.x`. Use `em` as unit. Default: 1 (16px)

# Global font settings used for all elements inside <body>.
global:
external: true
family: ZCOOL KuaiLe
size:

# Font settings for site title (.site-title).
title:
external: true
family:
size:

# Font settings for headlines (<h1> to <h6>).
headings:
external: true
family:
size:

# Font settings for posts (.post-body).
posts:
external: true
family: Noto Serif SC

# Font settings for <code> and code blocks.
codes:
external: true
family: Source Code Pro
位置:博客\source\_data\variables.styl(没有则自建)
1
$font-family-chinese      = "Noto Serif SC", "PingFang SC", "Microsoft YaHei";

要实现上述设置,则要将字体样式链接放入head.swig

位置:博客\source\_data\head.swig
1
<link href="https://fonts.loli.net/css2?family=Noto+Serif+SC:wght@200;300;400;500;600;700;900&family=Source+Code+Pro:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,900;1,200;1,300;1,400;1,500;1,600;1,700;1,900&family=ZCOOL+KuaiLe&display=swap" rel="stylesheet">

折叠

升级前本博客的折叠功能有些 BUG ,是由于打开新页面由于 PJAX 的原因,JS 脚本没有加载或加载错误导致的反复开折(解决方法为刷新页面)。
本次升级更换了实现折叠功能的方法( html5 的<summary>标签),实现方法如下

创建 js 代码

位置:主题\scripts\tags\folding.js(自行创建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';

function postFolding(args, content) {
args = args.join(' ').split(',');
let style = ''
let title = ''
if (args.length > 1) {
style = args[0].trim()
title = args[1].trim()
} else if (args.length > 0) {
title = args[0].trim()
}
if (style != undefined) {
return `<details ${style}><summary> ${hexo.render.renderSync({text: title, engine: 'markdown'}).split('\n').join('')} </summary>
<div class='content'>
${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}
</div>
</details>`;
} else {
return `<details><summary> ${hexo.render.renderSync({text: title, engine: 'markdown'}).split('\n').join('')} </summary>
<div class='content'>
${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}
</div>
</details>`;
}

}

hexo.extend.tag.register('folding', postFolding, {ends: true});

创建 css 样式(以我的为例[1]

位置:博客\source\_data\styles.styl(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
//折叠
//color
$color-mac-blue = #6483a5
$color-mac-blue1 = #284c73
$color-mac-cyan = #6c9aa3
$color-mac-cyan1 = #275963
$color-mac-green = #9ab59d
$color-mac-green1 = #336b39
$color-mac-yellow = #afa37d
$color-mac-yellow1 = #6b5b28
$color-mac-red = #b78f8f
$color-mac-red1 = #692929
// transition time
$time = 0.5s

details {
display: block
margin: 1rem 0
border-top-left-radius: 2px
border-top-right-radius: 2px
background: #282828
font-size: 0.9em
transition: all $time ease
-moz-transition: all $time ease
-webkit-transition: all $time ease
-o-transition: all $time ease
box-shadow: 0px 0 13px 3px rgba(0,0,0,0.5);
border-bottom: 6px dashed #181818;

summary {
cursor: pointer;
border-top-left-radius: 2px
border-top-right-radius: 2px
padding: 10px
outline: none;
font-weight: bold
position: relative
line-height: normal
color: #ccc
&:hover {
color: #000000
&:after {
position: absolute
color: #fff
content: '+'
text-align: center
top: 50%
transform: translateY(-50%)
right: 16px
}
}
>p, h1, h2, h3, h4, h5, h6 {
display: inline !important
border-bottom: none !important
}
}
&[blue] {
border-color: $color-mac-blue
> summary {
background:$color-mac-blue
}
}
&[cyan] {
border-color:$color-mac-cyan
> summary {
background:$color-mac-cyan
}
}
&[green] {
border-color:$color-mac-green
> summary {
background:$color-mac-green
}
}
&[yellow] {
border-color:$color-mac-yellow
> summary {
background:$color-mac-yellow
}
}
&[red] {
border-color:$color-mac-red
> summary {
background:$color-mac-red
}
}
}
details[open] {
> summary {
border-bottom: 4px solid #3e3e3e
color: #555
margin-bottom: 0
&:hover {
&:after {
content: '-'
}
}
}
&[blue] {
border-color: #181818
> summary {
border-bottom: 4px solid $color-mac-blue1
}
}
&[cyan] {
border-color: #181818
> summary {
border-bottom: 4px solid $color-mac-cyan1
}
}
&[green] {
border-color: #181818
> summary{
border-bottom: 4px solid $color-mac-green1
}
}
&[yellow] {
border-color: #181818
> summary {
border-bottom: 4px solid $color-mac-yellow1
}
}
&[red] {
border-color: #181818
> summary {
border-bottom: 4px solid $color-mac-red1
}
}
> div.content {
padding: 16px
margin-top: 0
}
}
@media (prefers-color-scheme: light)
details {
background: #f7f7f7
border-bottom: none;
box-shadow: 0px 0 13px 3px rgba(0,0,0,0.3);
summary {
color: #000
&:hover {
color: #ccc
&:after {
color: #000
}
}
}
}
details[open] {
> summary {
color: #555
border-bottom: 4px solid #e0e0e0
}
}

使用方法

1
2
3
4
5
6
7
{% folding 参数(可选), 标题 %}
内容
{% endfolding %}

// 参数
// 颜色:blue、cyan、green、yellow、red
// 状态:open

原折叠功能实现方法(与 PJAX 有些冲突)

建立 folding 标签

位置:博客\scripts\tags\folding_tag.js(自行创建)
1
2
3
4
5
6
7
8
/* global hexo */
// Usage: {% folding 点击显/隐内容 %} Something {% endfolding %}
function folding (args, content) {
var text = args[0];
if(!text) text = "点击显/隐";
return '<div><div class="folding_hider"><div class="close hider_title">' + text + '</div></div><div class="folding">\n' + hexo.render.renderSync({text: content, engine: 'markdown'}) + '\n</div></div>';
}
hexo.extend.tag.register('folding', folding, {ends: true});

折叠 js 代码

位置:主题\source\js\folding_action.js(自行创建)
1
2
3
4
5
6
7
8
$(document).ready(function(){
$(document).on('click', '.folding_hider', function(){
$('>.folding', this.parentNode).slideToggle();
$('>:first', this).toggleClass('open');
});
//默认情况下折叠
$("div.folding").css("display","none");
});

引入代码

位置:博客\source\_data\body-end.swig(没有则自建)
1
2
{# 折叠 #}
<script type="text/javascript" src="/js/folding_action.js"></script>

使用方法

1
2
3
{% fold %}
内容
{% endfold %}

本博客原折叠样式

位置:博客\source\_data\styles.styl(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 代码折叠功能添加
.hider_title{
padding-left: 9px
font-weight: bold;
cursor: pointer;
}
.fold {
padding-top: 9px;
padding-left: 9px;
padding-right: 9px;
margin-bottom: 9px
}
.close:after{
font-family: "ZCOOL KuaiLe";
content: " ▼(由于折叠功能与“PJAX”功能有冲突,如果出现反复开折情况,请刷新页面)";
}
.open:after{
font-family: "ZCOOL KuaiLe";
content: " ▲(由于折叠功能与“PJAX”功能有冲突,如果出现反复开折情况,请刷新页面)";
}
// 亮模式
@media (prefers-color-scheme: light)
// 代码折叠功能添加
.hider_title{
box-shadow: 0px 0 4px 3px rgba(0, 0, 0, 0.2);
background-color: #e4e4e4;
}
.fold {
box-shadow: 0px 6px 4px 3px rgba(0, 0, 0, 0.2);
background-color: rgba(228, 228, 228, 0.3);
border-bottom: 6px dashed #cccccc;
}
// 暗模式
@media (prefers-color-scheme: dark)
// 代码折叠功能添加
.hider_title{
background-color: #313131;
box-shadow: 0px 0 13px 3px rgba(0,0,0,0.5);
}
.fold {
box-shadow: 0px 6px 13px 3px rgba(0,0,0,0.5);
background-color: rgba(53, 53, 53, 0.3);
border-bottom: 6px dashed #131313;
}

点击效果

很多博客使用的四种效果(可按需求复制)

js 代码

礼花

位置:主题\source\js\cursor\fireworks.js(自行创建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
class Circle {
constructor({ origin, speed, color, angle, context }) {
this.origin = origin
this.position = { ...this.origin }
this.color = color
this.speed = speed
this.angle = angle
this.context = context
this.renderCount = 0
}

draw() {
this.context.fillStyle = this.color
this.context.beginPath()
this.context.arc(this.position.x, this.position.y, 2, 0, Math.PI * 2)
this.context.fill()
}

move() {
this.position.x = (Math.sin(this.angle) * this.speed) + this.position.x
this.position.y = (Math.cos(this.angle) * this.speed) + this.position.y + (this.renderCount * 0.3)
this.renderCount++
}
}

class Boom {
constructor ({ origin, context, circleCount = 16, area }) {
this.origin = origin
this.context = context
this.circleCount = circleCount
this.area = area
this.stop = false
this.circles = []
}

randomArray(range) {
const length = range.length
const randomIndex = Math.floor(length * Math.random())
return range[randomIndex]
}

randomColor() {
const range = ['8', '9', 'A', 'B', 'C', 'D', 'E', 'F']
return '#' + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range)
}

randomRange(start, end) {
return (end - start) * Math.random() + start
}

init() {
for(let i = 0; i < this.circleCount; i++) {
const circle = new Circle({
context: this.context,
origin: this.origin,
color: this.randomColor(),
angle: this.randomRange(Math.PI - 1, Math.PI + 1),
speed: this.randomRange(1, 6)
})
this.circles.push(circle)
}
}

move() {
this.circles.forEach((circle, index) => {
if (circle.position.x > this.area.width || circle.position.y > this.area.height) {
return this.circles.splice(index, 1)
}
circle.move()
})
if (this.circles.length == 0) {
this.stop = true
}
}

draw() {
this.circles.forEach(circle => circle.draw())
}
}

class CursorSpecialEffects {
constructor() {
this.computerCanvas = document.createElement('canvas')
this.renderCanvas = document.createElement('canvas')

this.computerContext = this.computerCanvas.getContext('2d')
this.renderContext = this.renderCanvas.getContext('2d')

this.globalWidth = window.innerWidth
this.globalHeight = window.innerHeight

this.booms = []
this.running = false
}

handleMouseDown(e) {
const boom = new Boom({
origin: { x: e.clientX, y: e.clientY },
context: this.computerContext,
area: {
width: this.globalWidth,
height: this.globalHeight
}
})
boom.init()
this.booms.push(boom)
this.running || this.run()
}

handlePageHide() {
this.booms = []
this.running = false
}

init() {
const style = this.renderCanvas.style
style.position = 'fixed'
style.top = style.left = 0
style.zIndex = '999999999999999999999999999999999999999999'
style.pointerEvents = 'none'

style.width = this.renderCanvas.width = this.computerCanvas.width = this.globalWidth
style.height = this.renderCanvas.height = this.computerCanvas.height = this.globalHeight

document.body.append(this.renderCanvas)

window.addEventListener('mousedown', this.handleMouseDown.bind(this))
window.addEventListener('pagehide', this.handlePageHide.bind(this))
}

run() {
this.running = true
if (this.booms.length == 0) {
return this.running = false
}

requestAnimationFrame(this.run.bind(this))

this.computerContext.clearRect(0, 0, this.globalWidth, this.globalHeight)
this.renderContext.clearRect(0, 0, this.globalWidth, this.globalHeight)

this.booms.forEach((boom, index) => {
if (boom.stop) {
return this.booms.splice(index, 1)
}
boom.move()
boom.draw()
})
this.renderContext.drawImage(this.computerCanvas, 0, 0, this.globalWidth, this.globalHeight)
}
}

const cursorSpecialEffects = new CursorSpecialEffects()
cursorSpecialEffects.init()

爆炸

位置:主题\source\js\cursor\explosion.min.js(自行创建)
1
"use strict";function updateCoords(e){pointerX=(e.clientX||e.touches[0].clientX)-canvasEl.getBoundingClientRect().left,pointerY=e.clientY||e.touches[0].clientY-canvasEl.getBoundingClientRect().top}function setParticuleDirection(e){var t=anime.random(0,360)*Math.PI/180,a=anime.random(50,180),n=[-1,1][anime.random(0,1)]*a;return{x:e.x+n*Math.cos(t),y:e.y+n*Math.sin(t)}}function createParticule(e,t){var a={};return a.x=e,a.y=t,a.color=colors[anime.random(0,colors.length-1)],a.radius=anime.random(16,32),a.endPos=setParticuleDirection(a),a.draw=function(){ctx.beginPath(),ctx.arc(a.x,a.y,a.radius,0,2*Math.PI,!0),ctx.fillStyle=a.color,ctx.fill()},a}function createCircle(e,t){var a={};return a.x=e,a.y=t,a.color="#F00",a.radius=.1,a.alpha=.5,a.lineWidth=6,a.draw=function(){ctx.globalAlpha=a.alpha,ctx.beginPath(),ctx.arc(a.x,a.y,a.radius,0,2*Math.PI,!0),ctx.lineWidth=a.lineWidth,ctx.strokeStyle=a.color,ctx.stroke(),ctx.globalAlpha=1},a}function renderParticule(e){for(var t=0;t<e.animatables.length;t++)e.animatables[t].target.draw()}function animateParticules(e,t){for(var a=createCircle(e,t),n=[],i=0;i<numberOfParticules;i++)n.push(createParticule(e,t));anime.timeline().add({targets:n,x:function(e){return e.endPos.x},y:function(e){return e.endPos.y},radius:.1,duration:anime.random(1200,1800),easing:"easeOutExpo",update:renderParticule}).add({targets:a,radius:anime.random(80,160),lineWidth:0,alpha:{value:0,easing:"linear",duration:anime.random(600,800)},duration:anime.random(1200,1800),easing:"easeOutExpo",update:renderParticule,offset:0})}function debounce(e,t){var a;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){e.apply(n,i)},t)}}var canvasEl=document.querySelector(".fireworks");if(canvasEl){var ctx=canvasEl.getContext("2d"),numberOfParticules=30,pointerX=0,pointerY=0,tap="mousedown",colors=["#FF1461","#18FF92","#5A87FF","#FBF38C"],setCanvasSize=debounce(function(){canvasEl.width=2*window.innerWidth,canvasEl.height=2*window.innerHeight,canvasEl.style.width=window.innerWidth+"px",canvasEl.style.height=window.innerHeight+"px",canvasEl.getContext("2d").scale(2,2)},500),render=anime({duration:1/0,update:function(){ctx.clearRect(0,0,canvasEl.width,canvasEl.height)}});document.addEventListener(tap,function(e){"sidebar"!==e.target.id&&"toggle-sidebar"!==e.target.id&&"A"!==e.target.nodeName&&"IMG"!==e.target.nodeName&&(render.play(),updateCoords(e),animateParticules(pointerX,pointerY))},!1),setCanvasSize(),window.addEventListener("resize",setCanvasSize,!1)}

爱心

位置:主题\source\js\cursor\love.min.js(自行创建)
1
!function(e,t,a){function n(){c(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),o(),r()}function r(){for(var e=0;e<d.length;e++)d[e].alpha<=0?(t.body.removeChild(d[e].el),d.splice(e,1)):(d[e].y--,d[e].scale+=.004,d[e].alpha-=.013,d[e].el.style.cssText="left:"+d[e].x+"px;top:"+d[e].y+"px;opacity:"+d[e].alpha+";transform:scale("+d[e].scale+","+d[e].scale+") rotate(45deg);background:"+d[e].color+";z-index:99999");requestAnimationFrame(r)}function o(){var t="function"==typeof e.onclick&&e.onclick;e.onclick=function(e){t&&t(),i(e)}}function i(e){var a=t.createElement("div");a.className="heart",d.push({el:a,x:e.clientX-5,y:e.clientY-5,scale:1,alpha:1,color:s()}),t.body.appendChild(a)}function c(e){var a=t.createElement("style");a.type="text/css";try{a.appendChild(t.createTextNode(e))}catch(t){a.styleSheet.cssText=e}t.getElementsByTagName("head")[0].appendChild(a)}function s(){return"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}var d=[];e.requestAnimationFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)}}(),n()}(window,document);

文字

位置:主题\source\js\cursor\text.js(自行创建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var a_idx = 0;
jQuery(document).ready(function($) {
$("body").click(function(e) {
var a = new Array("喜欢我", "不喜欢我");
var $i = $("<span/>").text(a[a_idx]);
var x = e.pageX,
y = e.pageY;
$i.css({
"z-index": 99999,
"top": y - 28,
"left": x - a[a_idx].length * 8,
"position": "absolute",
"color": "#ff7a45"
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
}, 1500, function() {
$i.remove();
});
a_idx = (a_idx + 1) % a.length;
});
});

引入代码

位置:博客\source\_data\body-end.swig(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
{# 鼠标点击特效 #}
{% if theme.cursor_effect == "fireworks" %}
<script async src="/js/cursor/fireworks.js"></script>
{% elseif theme.cursor_effect == "explosion" %}
<canvas class="fireworks" style="position: fixed;left: 0;top: 0;z-index: 1; pointer-events: none;" ></canvas>
<script src="//cdn.bootcss.com/animejs/2.2.0/anime.min.js"></script>
<script async src="/js/cursor/explosion.min.js"></script>
{% elseif theme.cursor_effect == "love" %}
<script async src="/js/cursor/love.min.js"></script>
{% elseif theme.cursor_effect == "text" %}
<script async src="/js/cursor/text.js"></script>
{% endif %}

添加配置

位置:博客\source\_data\next.yml(没有则自建)
1
2
3
# 鼠标点击效果
# 效果名: fireworks | explosion | love | text
cursor_effect: fireworks

打字效果

js 代码

位置:主题\source\js\activate-power-mode.min.js(自行创建)
1
(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==='object'&&typeof module==='object')module.exports=factory();else if(typeof define==='function'&&define.amd)define([],factory);else if(typeof exports==='object')exports["POWERMODE"]=factory();else root["POWERMODE"]=factory()})(this,function(){return(function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:false};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=true;return module.exports}__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)})([function(module,exports,__webpack_require__){'use strict';var canvas=document.createElement('canvas');canvas.width=window.innerWidth;canvas.height=window.innerHeight;canvas.style.cssText='position:fixed;top:0;left:0;pointer-events:none;z-index:999999';window.addEventListener('resize',function(){canvas.width=window.innerWidth;canvas.height=window.innerHeight});document.body.appendChild(canvas);var context=canvas.getContext('2d');var particles=[];var particlePointer=0;POWERMODE.shake=true;function getRandom(min,max){return Math.random()*(max-min)+min}function getColor(el){if(POWERMODE.colorful){var u=getRandom(0,360);return'hsla('+getRandom(u-10,u+10)+', 100%, '+getRandom(50,80)+'%, '+1+')'}else{return window.getComputedStyle(el).color}}function getCaret(){var el=document.activeElement;var bcr;if(el.tagName==='TEXTAREA'||(el.tagName==='INPUT'&&el.getAttribute('type')==='text')){var offset=__webpack_require__(1)(el,el.selectionStart);bcr=el.getBoundingClientRect();return{x:offset.left+bcr.left,y:offset.top+bcr.top,color:getColor(el)}}var selection=window.getSelection();if(selection.rangeCount){var range=selection.getRangeAt(0);var startNode=range.startContainer;if(startNode.nodeType===document.TEXT_NODE){startNode=startNode.parentNode}bcr=range.getBoundingClientRect();return{x:bcr.left,y:bcr.top,color:getColor(startNode)}}return{x:0,y:0,color:'transparent'}}function createParticle(x,y,color){return{x:x,y:y,alpha:1,color:color,velocity:{x:-1+Math.random()*2,y:-3.5+Math.random()*2}}}function POWERMODE(){{var caret=getCaret();var numParticles=5+Math.round(Math.random()*10);while(numParticles--){particles[particlePointer]=createParticle(caret.x,caret.y,caret.color);particlePointer=(particlePointer+1)%500}}{if(POWERMODE.shake){var intensity=1+2*Math.random();var x=intensity*(Math.random()>0.5?-1:1);var y=intensity*(Math.random()>0.5?-1:1);document.body.style.marginLeft=x+'px';document.body.style.marginTop=y+'px';setTimeout(function(){document.body.style.marginLeft='';document.body.style.marginTop=''},75)}}};POWERMODE.colorful=false;function loop(){requestAnimationFrame(loop);context.clearRect(0,0,canvas.width,canvas.height);for(var i=0;i<particles.length;++i){var particle=particles[i];if(particle.alpha<=0.1)continue;particle.velocity.y+=0.075;particle.x+=particle.velocity.x;particle.y+=particle.velocity.y;particle.alpha*=0.96;context.globalAlpha=particle.alpha;context.fillStyle=particle.color;context.fillRect(Math.round(particle.x-1.5),Math.round(particle.y-1.5),3,3)}}requestAnimationFrame(loop);module.exports=POWERMODE},function(module,exports){(function(){var properties=['direction','boxSizing','width','height','overflowX','overflowY','borderTopWidth','borderRightWidth','borderBottomWidth','borderLeftWidth','borderStyle','paddingTop','paddingRight','paddingBottom','paddingLeft','fontStyle','fontVariant','fontWeight','fontStretch','fontSize','fontSizeAdjust','lineHeight','fontFamily','textAlign','textTransform','textIndent','textDecoration','letterSpacing','wordSpacing','tabSize','MozTabSize'];var isFirefox=window.mozInnerScreenX!=null;function getCaretCoordinates(element,position,options){var debug=options&&options.debug||false;if(debug){var el=document.querySelector('#input-textarea-caret-position-mirror-div');if(el){el.parentNode.removeChild(el)}}var div=document.createElement('div');div.id='input-textarea-caret-position-mirror-div';document.body.appendChild(div);var style=div.style;var computed=window.getComputedStyle?getComputedStyle(element):element.currentStyle;style.whiteSpace='pre-wrap';if(element.nodeName!=='INPUT')style.wordWrap='break-word';style.position='absolute';if(!debug)style.visibility='hidden';properties.forEach(function(prop){style[prop]=computed[prop]});if(isFirefox){if(element.scrollHeight>parseInt(computed.height))style.overflowY='scroll'}else{style.overflow='hidden'}div.textContent=element.value.substring(0,position);if(element.nodeName==='INPUT')div.textContent=div.textContent.replace(/\s/g,"\u00a0");var span=document.createElement('span');span.textContent=element.value.substring(position)||'.';div.appendChild(span);var coordinates={top:span.offsetTop+parseInt(computed['borderTopWidth']),left:span.offsetLeft+parseInt(computed['borderLeftWidth'])};if(debug){span.style.backgroundColor='#aaa'}else{document.body.removeChild(div)}return coordinates}if(typeof module!="undefined"&&typeof module.exports!="undefined"){module.exports=getCaretCoordinates}else{window.getCaretCoordinates=getCaretCoordinates}}())}])});

引入代码

位置:博客\source\_data\body-end.swig(没有则自建)
1
2
3
4
5
6
7
8
9
{# 打字特效 #}
{% if theme.typing_effect %}
<script src="/js/activate-power-mode.min.js"></script>
<script>
POWERMODE.colorful = {{ theme.typing_effect.colorful }};
POWERMODE.shake = {{ theme.typing_effect.shake }};
document.body.addEventListener('input', POWERMODE);
</script>
{% endif %}

添加配置

位置:博客\source\_data\next.yml(没有则自建)
1
2
3
4
# 打字特效
typing_effect:
colorful: true # 礼花特效
shake: false # 震动特效

建站时间

位置:博客\source\_data\footer.swig(没有则自建)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{# 页脚站点运行时间统计 #}
{% if theme.footer.ages.enable %}
<script src="https://cdn.jsdelivr.net/npm/moment@2.22.2/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/moment-precise-range-plugin@1.3.0/moment-precise-range.min.js"></script>
<script>
function timer() {
var ages = moment.preciseDiff(moment(),moment({{ theme.footer.ages.birthday }},"YYYYMMDDHHmmss"));
ages = ages.replace(/years?/, "年");
ages = ages.replace(/months?/, "月");
ages = ages.replace(/days?/, "天");
ages = ages.replace(/hours?/, "小时");
ages = ages.replace(/minutes?/, "分");
ages = ages.replace(/seconds?/, "秒");
ages = ages.replace(/\d+/g, '<span style="color:{{ theme.footer.ages.color }}">$&</span>');
div.innerHTML = `{{ __('footer.age')}} ${ages}`;
}
var div = document.createElement("div");
//插入到copyright之后
var copyright = document.querySelector(".copyright");
document.querySelector(".footer-inner").insertBefore(div, copyright.nextSibling);
timer();
setInterval("timer()",1000)
</script>
{% endif %}
位置:博客\source\_data\next.yml(没有则自建)
1
2
3
4
5
6
7
8
9
footer:
# 配置网站运行时间
ages:
# 开关
enable: true
# 此处填写你网站的创建时间,YYYYMMDDHHmmss,注意格式
birthday: 20180708000000
# 数字显示的颜色
color: "#C399FC"

  1. 1.本样式支持亮/暗主题切换
  2. 2.“模板文件夹”:存放 post、page、draft 模板
  3. 3.“资源文件夹”:用于存放 pots、_data、page、js、robots.txt、CNAME、fonts 等文件
  4. 4.“主题文件夹”:存放博客主题,备份时不包括主题件夹中的 .git 隐藏文件夹(备份时删去)
  5. 5.“忽略列表文件”:在 push 时忽略文件的列表
  6. 6.“博客配置文件”:不做解释
  7. 7.“压缩插件 js 文件”:用于压缩插件 gulp 的运行支持
  8. 8.“模块列表文件”:安装的插件/模块的目录(回复时根据此列表下载内容)
  9. 9.分流解析时注意线路类型
  10. 10.以本博客 Valine 表情为例
  11. 11.参考: