前言

转载自:Fomalhaut同款页脚

效果预览

注:框出来的徽标可以自行制作,参考页脚徽标制作

实现步骤

  1. [BlogRoot]/themes/butterfly/layout/includes/footer.pug替换成如下代码这块东西分为几个部分,一个是以#ft为块的DOM,其中分为了格言猜你想看推荐友链三部分,参考图中的位置结合自己的喜好进行修改即可,图像、文字和链接均替换成你自己的(记住不要用我的链接!!!);if theme.footer.owner.enable起这一块是主题指定的信息版权信息,我把主题配置项的copyrightcustom_text这两项留空了,因此只会显示©2022 By Fomalhaut🥝;再然后就是#workboard这块,这块的信息由js逻辑写入与更新,可以自定义;最后是p#ghbdages这块,是徽标显示,大家可以到shields.io按照自己的信息生成(不要用我的!!!):
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
#footer-wrap
#ft
.ft-item-1
.t-top
.t-t-l
p.ft-t.t-l-t Motto🧬
.bg-ad
div
| A contented mind is a perpetual feast. 知足常乐🍰
.btn-xz-box
a.btn-xz(href='https://www.dqywy.top/about/') 关于博主
.t-t-r
p.ft-t.t-l-t 猜你想看💡
ul.ft-links
li
a(href='/posts/eec9786.html') 🐳魔改指南
a(href='/box/nav/') 👻待做清单
li
a(href='/personal/about/') 🪜文章分类
a(href='/archives/') 🧭文章标签
li
a(href='/categories/') 🔍时间轴
a(href='/tags/') ⭐Github

.ft-item-2
p.ft-t 推荐友链⌛
.ft-img-group
.img-group-item
a(href='http://47.109.96.67:4000/' title='攀墙の博客')
img(src='https://s1.ax1x.com/2023/05/07/p9wAPit.jpg' alt='图片出问题啦~')

if theme.footer.owner.enable
- var now = new Date()
- var nowYear = now.getFullYear()
if theme.footer.owner.since && theme.footer.owner.since != nowYear
.copyright
span!= `<b>&copy;${theme.footer.owner.since} - ${nowYear}</b>`
span!= `<b>&nbsp;&nbsp;By ${config.author}</b>`
else
.copyright
span!= `<b>&copy;${nowYear}</b>`
span!= `<b>&nbsp;&nbsp;By ${config.author}</b>`
if theme.footer.copyright
.framework-info
span= _p('footer.framework') + ' '
a(href='https://hexo.io')= 'Hexo'
span.footer-separator |
span= _p('footer.theme') + ' '
a(href='https://github.com/jerryc127/hexo-theme-butterfly')= 'Butterfly'
if theme.footer.custom_text
.footer_custom_text!=`${theme.footer.custom_text}`

#workboard

p#ghbdages
a.github-badge(target='_blank' href="https://hexo.io/" style='margin-inline:5px' title="博客框架为Hexo_v6.3.0")
img(src="https://img.shields.io/badge/Frame-Hexo-blue?logo=Hexo&style=plastic" alt='')

a.github-badge(target='_blank' href="https://butterfly.js.org/" style='margin-inline:5px' title="主题版本Butterfly_v3.8.1")
img(src="https://sourcebucket.s3.ladydaily.com/badge/Theme-Butterfly-6513df.svg" alt='')

a.github-badge(target='_blank' href="https://vercel.com/" style='margin-inline:5px' title="本站采用多线部署,主线路托管于Vercel")
img(src="https://sourcebucket.s3.ladydaily.com/badge/Hosted-Vercel-brightgreen.svg" alt='')

a.github-badge(target='_blank' href="https://github.com/hellodqy/hellodqy.github.io" style='margin-inline:5px' title="本网站源码由Github提供存储仓库")
img(src=" https://sourcebucket.s3.ladydaily.com/badge/Source-Github-d021d6.svg" alt='')

a.github-badge(target='_blank' href="https://www.algolia.com/" style='margin-inline:5px' title="本网站搜索引擎由Algolia提供")
img(src="https://img.shields.io/badge/Search-Algolia-9cf?logo=algolia&style=plastic" alt='')

a.github-badge(target='_blank' href="https://account.mongodb.com/" style='margin-inline:5px' title="本网站数据库由MongoDB提供")
img(src="https://img.shields.io/badge/DataBase-MongoDB-orange?logo=MongoDB&style=plastic" alt='')

a.github-badge(target='_blank' href="https://bz.zzzmh.cn/index" style='margin-inline:5px' title="本网站壁纸封面由极简壁纸提供")
img(src="https://img.shields.io/badge/Wallpaper-Minimalism-ff69b4?logo=Hexo&style=plastic" alt='')

a.github-badge(target='_blank' href="https://smms.app/" style='margin-inline:5px' title="本网站图床由SMMS提供")
img(src="https://img.shields.io/badge/Photos-SMMS-red?logo=smashingmagazine&style=plastic" alt='')
  1. 将以下代码复制到自定义的custom.css中,其中颜色、圆角等可以根据你自己的喜好进行修改:
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/* tzy页脚样式 */
#ft {
max-width: 1200px;
margin: 0 auto 12px;
display: flex;
color: auto;
text-align: left;
flex-wrap: wrap;
}

.ft-item-1,
.ft-item-2 {
display: flex;
height: 100%;
padding: 2px 14px;
}

.ft-item-1 {
flex-direction: column;
flex: 2;
}

.ft-item-2 {
flex: 1;
flex-direction: column;
}

.t-top {
display: flex;
}

.t-top .t-t-l {
display: flex;
flex-direction: column;
flex: 1.4;
margin-right: 10px;
}

.t-top .t-t-l .bg-ad {
width: 85%;
border-radius: 10px;
padding: 0 10px;
}

.btn-xz-box {
margin-top: 10px;
}

/* 按钮背景颜色等 */
.btn-xz {
display: block;
background-color: var(--btn-bg);
color: var(--btn-color);
text-align: center;
line-height: 2.4;
margin: 8px 0;
}

.btn-xz:hover {
text-decoration: none !important;
}
/* 按钮悬浮颜色 */
.btn-xz-box:hover .btn-xz {
background-color: var(--text-bg-hover);
}

.t-top .t-t-r {
display: flex;
flex-direction: column;
flex: 1;
}

.ft-links {
padding: 0 14px;
list-style: none;
margin-top: 0 !important;
}

.ft-links li a {
display: inline-block !important;
width: 50%;
}
/* 链接悬浮颜色 */
.ft-links li a:hover {
text-decoration: none !important;
color: var(--theme-color) !important;
}

.ft-item-2 .ft-img-group {
width: 100%;
}

.ft-t {
font-size: 1.1rem;
margin-bottom: 20px;
line-height: 1;
font-weight: 600;
}

.t-l-t {
padding-left: 14px;
}

.ft-item-2 .ft-img-group .img-group-item {
display: inline-block;
width: 18.4%;
margin-right: 14px;
margin-bottom: 6px;
}

.ft-item-2 .ft-img-group .img-group-item a {
display: inline-block;
width: 100%;
height: 100%;
}

.ft-item-2 .ft-img-group .img-group-item a img {
width: 100%;
max-height: 80px;
border-radius: 10px;
}
/* 头像悬浮颜色框 */
.ft-item-2 .ft-img-group .img-group-item a img:hover {
border: 2px solid var(--theme-color);
}

@media screen and (max-width: 768px) {
.ft-item-1 {
flex-basis: 100% !important;
}

.ft-item-2 {
flex-basis: 100% !important;
}

.t-top .t-t-l .bg-ad {
width: 100%;
}
}

@media screen and (max-width: 576px) {
.t-top {
flex-wrap: wrap;
}

.t-top .t-t-l {
flex-basis: 100% !important;
}

.t-top .t-t-r {
margin-top: 16px;
flex-basis: 100% !important;
}
}
#footer-wrap a {
border-radius: 30px;
}
#footer-wrap {
padding: 20px 20px;
}

/* 页脚心跳动画 */
#heartbeat {
color: red;
animation: iconAnimate 1s ease-in-out infinite;
}
@-moz-keyframes iconAnimate {
0%,
100% {
transform: scale(1);
}
10%,
30% {
transform: scale(0.9);
}
20%,
40%,
60%,
80% {
transform: scale(1.1);
}
50%,
70% {
transform: scale(1.1);
}
}
@-webkit-keyframes iconAnimate {
0%,
100% {
transform: scale(1);
}
10%,
30% {
transform: scale(0.9);
}
20%,
40%,
60%,
80% {
transform: scale(1.1);
}
50%,
70% {
transform: scale(1.1);
}
}
@-o-keyframes iconAnimate {
0%,
100% {
transform: scale(1);
}
10%,
30% {
transform: scale(0.9);
}
20%,
40%,
60%,
80% {
transform: scale(1.1);
}
50%,
70% {
transform: scale(1.1);
}
}
@keyframes iconAnimate {
0%,
100% {
transform: scale(1);
}
10%,
30% {
transform: scale(0.9);
}
20%,
40%,
60%,
80% {
transform: scale(1.1);
}
50%,
70% {
transform: scale(1.1);
}
}

  1. 然后计时器还要往#footer-wrap这块元素上面写入网站运行时间等信息,新建文件[BlogRoot]\source\js\runtime.js,写入如下代码。这里要修改的几块东西是:网站诞生时间currentTimeHtml这块东西;其中currentTimeHtml分为了两种模式,对应两个不同的图标,自行研究一下就懂!
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
var now = new Date();
function createtime() {
// 当前时间
now.setTime(now.getTime() + 1000);
var start = new Date("08/01/2022 00:00:00"); // 旅行者1号开始计算的时间
var dis = Math.trunc(23400000000 + ((now - start) / 1000) * 17); // 距离=秒数*速度 记住转换毫秒
var unit = (dis / 149600000).toFixed(6); // 天文单位
var grt = new Date("04/22/2023 00:00:00"); // 网站诞生时间 月/日/年 时:分:秒
var days = (now - grt) / 1e3 / 60 / 60 / 24,
dnum = Math.floor(days),
hours = (now - grt) / 1e3 / 60 / 60 - 24 * dnum,
hnum = Math.floor(hours);
1 == String(hnum).length && (hnum = "0" + hnum);
var minutes = (now - grt) / 1e3 / 60 - 1440 * dnum - 60 * hnum,
mnum = Math.floor(minutes);
1 == String(mnum).length && (mnum = "0" + mnum);
var seconds = (now - grt) / 1e3 - 86400 * dnum - 3600 * hnum - 60 * mnum,
snum = Math.round(seconds);
1 == String(snum).length && (snum = "0" + snum);
let currentTimeHtml = "";
(currentTimeHtml =
hnum < 18 && hnum >= 9
? `<img class='boardsign' src='https://img.shields.io/badge/DQY&WY%E3%81%AE%E5%B0%8F%E7%AA%9D-%E7%A3%95%E7%9D%A1%E7%9D%80%E5%91%A2-ff69b4?logo=westerndigital&style=plastic' title='没事就多陪陪女朋友~'><br> <div style="font-size:13px;font-weight:bold">本站居然运行了 ${dnum}${hnum} 小时 ${mnum}${snum} 秒 <i id="heartbeat" class='fas fa-heartbeat'></i> <br> 旅行者 1 号当前距离地球 ${dis} 千米,约为 ${unit} 个天文单位 🚀</div>`
: `<img class='boardsign' src='https://img.shields.io/badge/DQY&WY%E3%81%AE%E5%B0%8F%E7%AA%9D-%E7%A3%95%E7%9D%A1%E7%9D%80%E5%91%A2-ff69b4?logo=westerndigital&style=plastic' title='没事儿就多陪陪女朋友~'><br> <div style="font-size:13px;font-weight:bold">本站居然运行了 ${dnum}${hnum} 小时 ${mnum}${snum} 秒 <i id="heartbeat" class='fas fa-heartbeat'></i> <br> 旅行者 1 号当前距离地球 ${dis} 千米,约为 ${unit} 个天文单位 🚀</div>`),
document.getElementById("workboard") &&
(document.getElementById("workboard").innerHTML = currentTimeHtml);
}
// 设置重复执行函数,周期1000ms
setInterval(() => {
createtime();
}, 1000);
  1. 在主题配置文件_config.butterfly.yml引入该runtime.js文件:
1
2
3
inject:
bottom:
+ - <script defer src="/js/runtime.js"></script> # 页脚计时器
  1. hexo三连