本期将为大家讲解Hexo Butterfly主题的使用。

1. 主题介绍

hexo-theme-butterfly是基于 Molunerfinnhexo-theme-melody 的基础上进行开发的,当前版本是v4.13.0

主题官网:https://github.com/jerryc127/hexo-theme-butterfly

官网效果图:

image-20240725002747897

2. 主题安装

2.1 下载主题

建议你使用clone最新版本的方式,之后的更新可以通过 git pull 来快速更新, 而不用再次下载压缩包替换。

切换到博客的主题根目录下打开Git Bash并执行以下命令:

1
git clone https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly

下载完成后,会在项目themes目录下生成butterfly文件夹。

image-20240725002906207

如果没有修改代码的需求可以直接通过npm来安装。

1
npm i hexo-theme-butterfly

仅支持Hexo 5.0.0及以上版本

2.2 渲染器下载

需要安装安装pugstylus 渲染器,否则启动之后访问页面会报错。

错误内容: extends includes/layout.pug block content include ./includes/mixins/post-ui.pug #recent-posts.recent-posts +postUI include includes/pagination.pug

1
npm install hexo-renderer-pug hexo-renderer-stylus --save

2.3 切换主题

与所有 Hexo 主题启用的模式一样。当 克隆/下载 完成后,打开 站点配置文件, 找到 theme 字段,并将其值更改为 butterfly

1
theme: butterfly

到此,Butterfly主题安装完成。

2.4 验证主题

启动服务并访问http://localhost:4000查看效果.

1
hexo clean && hexo s

image-20240725003448163

3. 主题配置

主题配置文件themes/butterfly/_config.yml

3.1 配置说明

以下是themes/butterfly/_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
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
# Navigation bar settings (导航栏设置)

# 见 https://butterfly.js.org/posts/4aa8abbe/##导航栏设置-Navigation-bar-settings

# --------------------------------------

nav:

logo: # 图片

display_title: true

fixed: false # 固定导航栏

# Menu 目录

menu:

# Home: / || fas fa-home

# Archives: /archives/ || fas fa-archive

# Tags: /tags/ || fas fa-tags

# Categories: /categories/ || fas fa-folder-open

# List||fas fa-list:

# Music: /music/ || fas fa-music

# Movie: /movies/ || fas fa-video

# Link: /link/ || fas fa-link

# About: /about/ || fas fa-heart

# Code Blocks (代码块相关)

# --------------------------------------

highlight_theme: light # darker / pale night / light / ocean / false

highlight_height_limit: false # 单位:像素

code_word_wrap: false

# 高亮工具栏

highlight_theme_macStyle: false # 使用 Mac 风格

highlight_copy: true # 复制按钮

highlight_lang: true # 显示代码语言

highlight_shrink: false # true: 收缩代码块 / false: 展开代码块 | none: 展开代码块并隐藏按钮

highlight_fullpage: true # true: 添加切换全屏的按钮

# Social Settings (社交图标设置)

# 正式:

# icon: 链接 || 描述 || 颜色

social:

# fab fa-github: https://github.com/xxxxx || Github || '#24292e'

# fas fa-envelope: mailto:xxxxxx@gmail.com || Email || '#4a7dbe'

# Image (图片设置)

# --------------------------------------

# Favicon(网站图标)

favicon: /img/favicon.png

# Avatar (头像)

avatar:

img: https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png

effect: false

# 禁用所有横幅图片

disable_top_img: false

# 首页的横幅图片

index_img:

# 如果页面没有设置横幅,则显示顶部图片

default_top_img:

# 归档页面的横幅图片

archive_img:

# 如果标签页面没有设置横幅,则显示顶部图片

# 注意:标签页面,不是标签页面(子标签页面的顶部图片)

tag_img:

# 标签页面的横幅图片

# 格式:

# - 标签名: xxxxx

tag_per_img:

# 如果分类页面没有设置横幅,则显示顶部图片

# 注意:分类页面,不是分类页面(子分类页面的顶部图片)

category_img:

# 分类页面的横幅图片

# 格式:

# - 分类名: xxxxx

category_per_img:

# 封面

cover:

# 是否显示文章封面

index_enable: true

aside_enable: true

archives_enable: true

# 首页封面显示的位置

# left/right/both

position: both

# 当没有设置封面时,显示默认封面

default_cover:

# - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg

# 替换无法显示的图片

error_img:

flink: /img/friend_404.gif

post_page: /img/404.jpg

# 一个简单的 404 页面

error_404:

enable: false

subtitle: '页面未找到'

background: https://i.loli.net/2020/05/19/aKOcLiyPl2JQdFD.png

# post_meta 页面元数据

post_meta:

page: # 首页

date_type: created # created 或 updated 或 both 主页文章日期显示创建日或者更新日或都显示

date_format: date # date 或 relative 显示日期还是相对日期

categories: true # true 或 false 主页是否显示分类

tags: false # true 或 false 主页是否显示标签

label: true # true 或 false 显示描述性文字

post:

position: left # left 或 center 文章页标题位置

date_type: both # created 或 updated 或 both 文章页日期显示创建日或者更新日或都显示

date_format: date # date 或 relative 显示日期还是相对日期

categories: true # true 或 false 文章页是否显示分类

tags: true # true 或 false 文章页是否显示标签

label: true # true 或 false 显示描述性文字

# 在首页显示文章介绍

# 1: description

# 2: both (如果描述存在,则显示描述,否则显示自动摘要)

# 3: auto_excerpt (默认)

# false: 不显示文章介绍

index_post_content:

method: 3

length: 500 # 如果你设置方法为 2 或 3,需要配置长度

# 锚点

anchor:

# 当你滚动时,URL 将根据标题 id 更新

auto_update: false

# 点击标题滚动并更新锚点

click_to_scroll: false

# 图片描述文字

photofigcaption: false

# 复制设置

# copyright: 在复制内容后面添加版权信息

copy:

enable: true

copyright:

enable: false

limit_count: 50

# 文章

# --------------------------------------

# toc (目录)

toc:

post: true

page: false

number: true

expand: false

style_simple: false # 针对文章

scroll_percent: true

# 文章版权

post_copyright:

enable: true

decode: false

author_href:

license: CC BY-NC-SA 4.0

license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/

# 赞助/打赏

reward:

enable: false

text:

QR_code:

# - img: /img/wechat.jpg

# link:

# text: wechat

# - img: /img/alipay.jpg

# link:

# text: alipay

# 文章编辑

# 在线轻松浏览和编辑博客源代码

post_edit:

enable: false

# url: https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name/

# 例如: https://github.com/jerryc127/butterfly.js.org/edit/main/source/

url:

# 相关文章

related_post:

enable: true

limit: 6 # 显示的文章数量

date_type: created # 或者 created 或 updated 文章日期显示创建日或者更新日

# 文章分页

# value: 1 || 2 || false

# 1: 下一篇文章将链接到旧文章

# 2: 下一篇文章将链接到新文章

# false: 禁用分页

post_pagination: 1

# 显示文章的过时提醒

noticeOutdate:

enable: false

style: flat # 风格: simple/flat

limit_day: 500 # 何时显示

position: top # 位置: top/bottom

message_prev: 已经有

message_next: 天未更新,文章内容可能已过时。

# 页脚设置

# --------------------------------------

footer:

owner:

enable: true

since: 2020

custom_text:

copyright: true # 主题和框架的版权

# 侧边栏

# --------------------------------------

aside:

enable: true

hide: false

button: true

mobile: true # 在移动设备上显示

position: right # left or right

display:

archive: true

tag: true

category: true

card_author:

enable: true

description:

button:

enable: true

icon: fab fa-github

text: 关注我

link: https://github.com/xxxxxx

card_announcement:

enable: true

content: 这是我的博客

card_recent_post:

enable: true

limit: 5 # 如果设置为 0 将显示全部

sort: date # date 或 updated

sort_order: # 除非你知道它如何工作,否则不要修改设置

card_categories:

enable: true

limit: 8 # 如果设置为 0 将显示全部

expand: none # none/true/false

sort_order: # 除非你知道它如何工作,否则不要修改设置

card_tags:

enable: true

limit: 40 # 如果设置为 0 将显示全部

color: false

orderby: random # 标签顺序,random/name/length

order: 1 # 排序方式。1,升序;-1,降序

sort_order: # 除非你知道它如何工作,否则不要修改设置

card_archives:

enable: true

type: monthly # yearly 或 monthly

format: MMMM YYYY # 例如:YYYY年MM月

order: -1 # 排序方式。1,升序;-1,降序

limit: 8 # 如果设置为 0 将显示全部

sort_order: # 除非你知道它如何工作,否则不要修改设置

card_webinfo:

enable: true

post_count: true

last_push_date: true

sort_order: # 除非你知道它如何工作,否则不要修改设置

card_post_series:

enable: true

series_title: false # 标题显示系列名称

orderBy: 'date' # 按标题或日期排序

order: -1 # 排序方式。1,升序;-1,降序

# 网站访问人数统计

busuanzi:

site_uv: true

site_pv: true

page_pv: true

# 网页运行时间(发布日期与现在的时间差)

# 格式:Month/Day/Year Time or Year/Month/Day Time

runtimeshow:

enable: false

publish_date:

# 侧边栏小部件 - 最新评论

newest_comments:

enable: false

sort_order:

limit: 6

storage: 10 # 单位:分钟,数据保存到 localStorage

avatar: true

# 右下角按钮

# --------------------------------------

# 简繁转换

translate:

enable: false

# 按钮的文本

default: 繁

# 网站的语言 (1 - 繁体中文 / 2 - 简体中文)

defaultEncoding: 2

# 时间延迟

translateDelay: 0

# 简体字状态下按钮的文本

msgToTraditionalChinese: '繁'

# 繁体字状态下按钮的文本

msgToSimplifiedChinese: '简'

# 阅读模式

readmode: true

# 暗色模式

darkmode:

enable: true

# 切换暗色/浅色模式的按钮

button: true

# 自动切换暗色/浅色模式 (自动切换 dark mode 和 light mode)

# autoChangeMode: 1 跟随系统设置,如果系统不支持暗色模式,则在下午 6 点到早上 6 点之间切换暗色模式

# autoChangeMode: 2 在下午 6 点到早上 6 点之间切换暗色模式

# autoChangeMode: false

autoChangeMode: false

# 设置浅色模式的时间。取值范围是 0 到 24。如果没有设置,默认值是 6 和 18

start:

end:

# 在返回顶部按钮中显示滚动百分比

rightside_scroll_percent: false

# 除非你知道它们如何工作,否则不要修改以下设置

# 选择:readmode,translate,darkmode,hideAside,toc,chat,comment

# 不要重复

rightside_item_order:

enable: false

hide: # readmode,translate,darkmode,hideAside

show: # toc,chat,comment

# Math (數學)

# --------------------------------------

# 关于每页的设置

# 如果你设置为 true,它将在每一页都加载 mathjax/katex 脚本 (true 表示每一页都加载 js)

# 如果你设置为 false,它将根据你的设置加载 mathjax/katex 脚本 (需要在页面的 Markdown Front-matter 中添加 mathjax: true)

# (false 按需加载,必须在使用的 Markdown Front-matter 中添加 mathjax: true)

# MathJax

mathjax:

enable: false

per_page: false

# KaTeX

katex:

enable: false

per_page: false

hide_scrollbar: true

# 搜索

# 见 https://butterfly.js.org/posts/ceeb73f/#搜索系统

# --------------------------------------

# Algolia 搜索

algolia_search:

enable: false

hits:

per_page: 6

# 本地搜索

local_search:

enable: false

# 页面加载时预加载搜索数据

preload: false

# 每篇文章显示前 n 个结果,设置为 -1 显示所有结果

top_n_per_article: 1

# 将 HTML 字符串转换为可读的格式

unescape: false

CDN:

# Docsearch

docsearch:

enable: false

appId:

apiKey:

indexName:

option:

# 分享系统

# --------------------------------------

# Share.js

# https://github.com/overtrue/share.js

sharejs:

enable: true

sites: facebook,twitter,wechat,weibo,qq

# AddToAny

# https://www.addtoany.com/

addtoany:

enable: false

item: facebook,twitter,wechat,sina_weibo,facebook_messenger,email,copy_link

# 评论系统

# --------------------------------------

comments:

# 最多可以选择两个评论系统,第一个将作为默认显示

# 选择:Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/Artalk

use:

text: true # 在按钮旁边显示评论名称

# lazyload: 当评论元素进入浏览器视口时,评论系统将被加载。

# 如果你设置为 true,则评论计数将无效

lazyload: false

count: false # 在文章顶部图片中显示评论计数

card_post_count: false # 在首页显示评论计数

# Disqus

# https://disqus.com/

disqus:

shortname:

apikey: # 用于最新评论小部件

# DisqusJS 评论系统,可以在网络审查地区加载 Disqus 评论列表,兼容原版

# https://github.com/SukkaW/DisqusJS

disqusjs:

shortname:

apikey:

option:

# Livere (来必力)

# https://www.livere.com/

livere:

uid:

# Gitalk

# https://github.com/gitalk/gitalk

gitalk:

client_id:

client_secret:

repo:

owner:

admin:

option:

# Valine

# https://valine.js.org

valine:

appId: # Leancloud 应用 App ID

appKey: # Leancloud 应用 App 密钥

avatar: monsterid # Gravatar 风格 https://valine.js.org/#/avatar

serverURLs: # 此配置适用于国内自定义域名用户,海外版本将自动检测(无需手动填写)

bg: # Valine 背景

visitor: false

option:

# Waline - 一个简单的带有后端支持的评论系统,Valine 的一个分支

# https://waline.js.org/

waline:

serverURL: # Waline 服务器地址 URL

bg: # Waline 背景

pageview: false

option:

# Utterances

# https://utteranc.es/

utterances:

repo:

# 问题映射:pathname/url/title/og:title

issue_term: pathname

# 主题:github-light/github-dark/github-dark-orange/icy-dark/dark-blue/photon-dark

light_theme: github-light

dark_theme: photon-dark

# Facebook Comments Plugin

# https://developers.facebook.com/docs/plugins/comments/

facebook_comments:

app_id:

user_id: # 可选

pageSize: 10 # 显示的评论数量

order_by: social # social/time/reverse_time

lang: zh_TW # 语言 en_US/zh_CN/zh_TW 等

# Twikoo

# https://github.com/imaegoo/twikoo

twikoo:

envId:

region:

visitor: false

option:

# Giscus

# https://giscus.app/

giscus:

repo:

repo_id:

category_id:

theme:

light: light

dark: dark

option:

# Remark42

# https://remark42.com/docs/configuration/frontend/

remark42:

host: # 你的主机 URL

siteId: # 你的站点 ID

option:

# Artalk

# https://artalk.js.org/guide/frontend/config.html

artalk:

server:

site:

visitor: false

option:

# 聊天服务

# --------------------------------------

# 聊天按钮 [推荐]

# 它将在网站右下角创建一个按钮,并隐藏原始按钮

chat_btn: false

# 当滚动至上部时显示原始聊天按钮,滚动下来时隐藏按钮

chat_hide_show: false

# Chatra

# https://chatra.io/

chatra:

enable: false

id:

# Tidio

# https://www.tidio.com/

tidio:

enable: false

public_key:

# Daovoice

# http://dashboard.daovoice.io/app

daovoice:

enable: false

app_id:

# Crisp

# https://crisp.chat/en/

crisp:

enable: false

website_id:

# Messenger

# https://developers.facebook.com/docs/messenger-platform/discovery/facebook-chat-plugin/

messenger:

enable: false

pageID:

lang: zh_TW # 语言 en_US/zh_CN/zh_TW 等

# 分析

# --------------------------------------

# Baidu Analytics

# https://tongji.baidu.com/web/welcome/login

baidu_analytics:

# Google Analytics

# https://analytics.google.com/analytics/web/

google_analytics:

# Cloudflare Analytics

# https://www.cloudflare.com/zh-tw/web-analytics/

cloudflare_analytics:

# Microsoft Clarity

# https://clarity.microsoft.com/

microsoft_clarity:

# 广告

# --------------------------------------

# Google Adsense (谷歌广告)

google_adsense:

enable: false

auto_ads: true

js: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js

client:

enable_page_level_ads: true

# 手动插入广告

# ad:

# index:

# aside:

# post:

# 站长验证

# --------------------------------------

site_verification:

# - name: google-site-verification

# content: xxxxxx

# - name: baidu-site-verification

# content: xxxxxxx

# 美化/效果

# --------------------------------------

# 自定义主题颜色

# 注意:颜色值必须用双引号引起来,如 "#000",否则可能会导致错误!

# theme_color:

# enable: true

# main: "#49B1F5"

# paginator: "#00c4b6"

# button_hover: "#FF7242"

# text_selection: "#00c4b6"

# link_color: "#99a9bf"

# meta_color: "#858585"

# hr_color: "#A4D8FA"

# code_foreground: "#F47466"

# code_background: "rgba(27, 31, 35, .05)"

# toc_color: "#00c4b6"

# blockquote_padding_color: "#49b1f5"

# blockquote_background_color: "#49b1f5"

# scrollbar_color: "#49b1f5"

# meta_theme_color_light: "ffffff"

# meta_theme_color_dark: "#0d0d0d"

# 首页的 top_img 设置

# 默认:top img - 全屏,site info - 中间(默认 top_img 全屏,site_info 在中间)

# 网站信息的位置,例如:300px/300em/300rem/10%(首页标题距离顶部的距离)

index_site_info_top:

# 首页 top_img 的高度,例如:300px/300em/300rem

index_top_img_height:

# 分类和标签页面的用户界面设置 (category 和 tag 页的 UI 设置)

# index - 与首页 UI 相同(index 值代表 UI 将与首页的 UI 一样)

# default - 与归档 UI 相同,默认跟 archives 页面 UI 一样

category_ui: # 留空或 index

tag_ui: # 留空或 index

# 拉伸行宽,使每一行宽度相等(文字两端对齐,对最后一行无效)

text_align_justify: false

# 设置网站背景

# 可以设置为颜色或图片(可设置图片 或者 颜色)

# 图片格式:url(http://xxxxxx.com/xxx.jpg)

background:

# 页脚背景

footer_bg: false

# 为 header 或 footer 添加黑色半透明遮罩

mask:

header: true

footer: true

# 右下角按钮距离底部的位置,默认单位为像素

rightside_bottom:

# 开启网页进入效果

enter_transitions: true

# 打字效果

# https://github.com/disjukr/activate-power-mode

activate_power_mode:

enable: false

colorful: true # 开启粒子动画(发光特效)

shake: true # 开启 shake(抖动特效)

mobile: false

# 背景特效

# --------------------------------------

# canvas_ribbon (静止彩带背景)

# 见: https://github.com/hustcc/ribbon.js

canvas_ribbon:

enable: false

size: 150

alpha: 0.6

zIndex: -1

click_to_change: false

mobile: false

# Fluttering Ribbon (动态彩带)

canvas_fluttering_ribbon:

enable: false

mobile: false

# canvas_nest

# https://github.com/hustcc/canvas-nest.js

canvas_nest:

enable: false

color: '0,0,255' # 线条的颜色,默认: '0,0,0';RGB 值:(R,G,B)。(注意:用 ',' 分隔)

opacity: 0.7 # 线条的透明度 (0~1),默认: 0.5

zIndex: -1 # 背景的 z-index 属性,默认: -1

count: 99 # 线条的数量,默认: 99

mobile: false

# 鼠标点击效果:烟花特效

fireworks:

enable: false

zIndex: 9999 # -1 或 9999

mobile: false

# 鼠标点击效果:爱心

click_heart:

enable: false

mobile: false

# 鼠标点击效果:文字

clickShowText:

enable: false

text:

# - 我

# - 爱

# - 你

fontSize: 15px

random: false

mobile: false

# 网站默认的显示模式

# light (默认) / dark

display_mode: light

# 美化页面显示

beautify:

enable: false

field: post # site/post

title-prefix-icon: # '\\f0c1'

title-prefix-icon-color: # '#F47466'

# 全局字体设置

# 除非你知道它们如何工作,否则不要修改以下设置

font:

global-font-size:

code-font-size:

font-family:

code-font-family:

# 网站标题和副标题的字体设置

# 左上角网站名字 主页居中网站名字

blog_title_font:

font_link:

font-family:

# 水平分隔线图标设置

hr_icon:

enable: true

icon: # 字体图标的 Unicode 值,例如 '\\3423'

icon-top:

# 首页副标题

subtitle:

enable: false

# 打字效果

effect: true

# 定制 typed.js

# https://github.com/mattboldt/typed.js/#customization

typed_option:

# source 调用第三方服务

# source: false 关闭调用

# source: 1 调用一言网的一句话(简体) https://hitokoto.cn/

# source: 2 调用一句网(简体) https://yijuzhan.com/

# source: 3 调用今日诗词(简体) https://www.jinrishici.com/

# subtitle 会先显示 source , 再显示 sub 的内容

source: false

# 如果关闭打字效果,subtitle 只会显示 sub 的第一行文字

sub:

# 加载动画

preloader:

enable: false

# source

# 1. fullpage-loading

# 2. pace (progress bar)

source:

# pace 主题 (见 https://codebyzach.github.io/pace/)

pace_css_url:

# 字数统计

# 见 https://butterfly.js.org/posts/ceeb73f/#字数统计

wordcount:

enable: false

post_wordcount: true

min2read: true

total_wordcount: true

# 图片大图查看模式

# --------------------------------------

# 只能选择一个,或者两个都不选

# medium-zoom

# https://github.com/francoischalifour/medium-zoom

medium_zoom: false

# fancybox

# https://fancyapps.com/fancybox/

fancybox: true

# 标签插件设置

# --------------------------------------

# series (系列文章)

series:

enable: true

orderBy: 'title' # 按标题或日期排序

order: 1 # 排序方式。1, 升序;-1, 降序

number: true

# abcjs (乐谱渲染)

# 见 https://github.com/paulrosen/abcjs

abcjs:

enable: false

per_page: true

# Mermaid

# 见 https://github.com/mermaid-js/mermaid

mermaid:

enable: true

# 以代码块形式书写 Mermaid 图表(以代码块形式书写 Mermaid)

code_write: false

# 内置主题: default/forest/dark/neutral

theme:

light: default

dark: dark

# Note (Bootstrap Callout)

note:

# Note 标签样式值:

# - simple bs-callout 旧版警告样式。默认。

# - modern bs-callout 新版 (v2-v3) 警告样式。

# - flat 带有背景的 flat callout 样式,类似于 Mozilla 或 StackOverflow。

# - disabled 禁用所有 CSS 样式的导入。

style: flat

icons: true

border_radius: 3

# 对现代和平面风格的背景进行百分比的偏移量更亮 (现代: -12 | 12; 平面: -18 | 6)。

# 偏移量也应用于标签变量。此选项可以与禁用的 note 标签一起使用。

light_bg_offset: 0

# 其他

# --------------------------------------

# Pjax

# 它可能包含错误并且不稳定,请在发现错误时提供反馈。

# https://github.com/MoOx/pjax

pjax:

enable: false

exclude:

# - xxxx

# - xxxx

# 注入 CSS 和脚本 (aplayer/meting)

aplayerInject:

enable: false

per_page: true

# Snackbar (Toast 通知弹窗)

# https://github.com/polonel/SnackBar

# position 弹窗位置

# 可选 top-left / top-center / top-right / bottom-left / bottom-center / bottom-right

snackbar:

enable: false

position: bottom-left

bg_light: '#49b1f5' # 浅色模式下 Toast 通知的背景颜色

bg_dark: '#1f1f1f' # 深色模式下 Toast 通知的背景颜色

# https://instant.page/

# prefetch (预加载)

instantpage: false

# https://github.com/vinta/pangu.js

# 在中英文之间添加空格

pangu:

enable: false

field: site # site/post

# 懒加载 (图片懒加载)

# https://github.com/verlok/vanilla-lazyload

lazyload:

enable: false

field: site # site/post

placeholder:

blur: false

# PWA

# 见 https://github.com/JLHwung/hexo-offline

# ---------------

# pwa:

# enable: false

# manifest: /pwa/manifest.json

# apple_touch_icon: /pwa/apple-touch-icon.png

# favicon_32_32: /pwa/32.png

# favicon_16_16: /pwa/16.png

# mask_icon: /pwa/safari-pinned-tab.svg

# Open graph 元标签

# https://developers.facebook.com/docs/sharing/webmasters/

Open_Graph_meta:

enable: true

option:

# twitter_card:

# twitter_image:

# twitter_id:

# twitter_site:

# google_plus:

# fb_admins:

# fb_app_id:

# 添加厂商前缀以确保兼容性

css_prefix: true

# 注入

# 在头部 ('<head>' 标签之前) 和底部 ('<body>' 标签之前) 插入代码

# 在头部 <head> 之前 和 底部 <body> 之前插入代码

inject:

head:

# - <link rel="stylesheet" href="/xxx.css">

bottom:

# - <script src="xxxx"></script>

# CDN

# 除非你知道它们如何工作,否则不要修改以下设置

# 非必要请不要修改

CDN:

# 主题内部 js 的 CDN 配置

# 选项: local/jsdelivr/unpkg/cdnjs/custom

# Dev 版本只能选择 (dev 版的主体只能设置为 local)

internal_provider: local

# 第三方 js 的 CDN 配置

# 选项: local/jsdelivr/unpkg/cdnjs/custom

# 当设置为 local 时,你需要安装 hexo-butterfly-extjs

third_party_provider: jsdelivr

# 在 URL 中添加版本号,true 或 false

version: true

# 自定义格式

# 例如: https://cdn.staticfile.org/${cdnjs_name}/${version}/${min_cdnjs_file}

custom_format:

option:

# abcjs_basic_js:

# activate_power_mode:

# algolia_js:

# algolia_search:

# aplayer_css:

# aplayer_js:

# artalk_css:

# artalk_js:

# blueimp_md5:

# busuanzi:

# canvas_fluttering_ribbon:

# canvas_nest:

# canvas_ribbon:

# click_heart:

# clickShowText:

# disqusjs:

# disqusjs_css:

# docsearch_css:

# docsearch_js:

# egjs_infinitegrid:

# fancybox:

# fancybox_css:

# fireworks:

# fontawesome:

# gitalk:

# gitalk_css:

# giscus:

# instantpage:

# instantsearch:

# katex:

# katex_copytex:

# lazyload:

# local_search:

# main:

# main_css:

# mathjax:

# medium_zoom:

# mermaid:

# meting_js:

# pangu:

# prismjs_autoloader:

# prismjs_js:

# prismjs_lineNumber_js:

# pjax:

# sharejs:

# sharejs_css:

# snackbar:

# snackbar_css:

# translate:

# twikoo:

# typed:

# utils:

# valine:

# waline_css:

# waline_js:

3.2 更改语言

首先我们要将英语改为中文;butterfly主题自带4种语言。

image-20240725012044302

编辑**站点配置文件**,修改语言设置。

1
language: zh-CN

image-20240723183636553

3.3 设置站点信息

效果图:

image-20240725201201567

打开**站点配置文件_config.yml)修改网站各种资料,例如标题、副标题和语言**等个人资料。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Site

title: '他乡遇故知' #标题

subtitle: '一步一句是相思' #副标题

description: '台下人金榜正题名,不曾认台上旧相识' #个性签名

keywords: null

author: 探窗 #作者

language: zh-CN #语言

timezone: '' #时区

3.4 设置导航菜单

效果图:

image-20240725201705809

编辑 themes/butterfly/_config.yml,修改以下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Menu 目錄

menu:

首页: / || fas fa-home

归档: /archives/ || fas fa-archive

标签: /tags/ || fas fa-tags

目录: /categories/ || fas fa-folder-open

列表||fas fa-list:

音乐: /music/ || fas fa-music

电影: /movies/ || fas fa-video

友情链接: /link/ || fas fa-link

关于我们: /about/ || fas fa-heart

3.5 代码块显示设置

效果图相当漂亮:

image-20240725235111621

编辑 themes/butterfly/_config.yml,修改以下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Code Blocks (代码块相关)

# --------------------------------------

highlight_theme: darker # darker / pale night / light / ocean / false

highlight_height_limit: false # 单位:像素

code_word_wrap: true

# 高亮工具栏

highlight_theme_macStyle: true # 使用 Mac 风格

highlight_copy: true # 复制按钮

highlight_lang: true # 显示代码语言

highlight_shrink: false # true: 收缩代码块 / false: 展开代码块 | none: 展开代码块并隐藏按钮

highlight_fullpage: true # true: 添加切换全屏的按钮

同时,将**站点配置文件**(_config.yml)中的highlight相关的配置注释掉。

1
2
3
4
5
6
7
8
9
10
11
#highlight:

# line_number: false

# auto_detect: false

# tab_replace: ''

# wrap: false

# hljs: false

3.6 设置导航栏图片

效果图如下:

image-20240725235610529

编辑 themes/butterfly/_config.yml,修改以下内容:

1
2
3
4
5
6
7
8
9
# Navigation bar settings (导航栏设置)

# 见 https://butterfly.js.org/posts/4aa8abbe/##导航栏设置-Navigation-bar-settings

# --------------------------------------

nav:

logo: /images/butterfly.png

本地图片在站点根目录的source文件夹里。

3.7 修改首页副标题

效果图:

image-20240726000432143

编辑 themes/butterfly/_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
# 首页副标题

subtitle:

# 是否开启:true:开启,false:不开启

enable: true

# 打字效果

effect: true

# 定制 typed.js

# https://github.com/mattboldt/typed.js/#customization

typed_option:

# source 调用第三方服务

# source: false 关闭调用

# source: 1 调用一言网的一句话(简体) https://hitokoto.cn/

# source: 2 调用一句网(简体) https://yijuzhan.com/

# source: 3 调用今日诗词(简体) https://www.jinrishici.com/

# subtitle 会先显示 source , 再显示 sub 的内容

source: false

# 如果关闭打字效果,subtitle 只会显示 sub 的第一行文字

sub:

- 你在抱怨什么呢

- 为明天到来的事,说人生像是没有意义

- 没有选择会是唯一的路

- 这不是你自己的问题,人终归要好好去生活

3.8 图片设置

图片链接地址可以是:

  • 完整的互联网 URI,如:http://example.com/avatar.png
  • 站点内的地址,主题或站点的source目录下。注意:是站点根目录的source文件夹里。

修改主题配置文件_config.butterfly.yml

  1. 网站图标

    1
    favicon: /img/favicon.png
  2. 头像

    1
    2
    3
    4
    5
    6
    7
    # Avatar (头像)

    avatar:

    img: /images/next_icon.png #https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png

    effect: false #是否一直转圈 false:不开启,true开启
  3. 主页横幅图片

    1
    2
    3
    # 首页的横幅图片

    index_img:
  4. 文章详情页顶部图片

    当没有在front-matter设置top_imgcover的情况下会显示该图

    1
    2
    3
    # 如果页面没有设置横幅,则显示顶部图片

    default_top_img: /img/default_top_img.png
  5. 归档页横幅图片

    1
    2
    3
    # 归档页面的横幅图片

    archive_img:
  6. tag标签页横幅图片

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # 如果标签页面没有设置横幅,则显示顶部图片

    # 注意:标签页面,不是标签页面(子标签页面的顶部图片)

    tag_img:

    # 具体标签页面的横幅图片

    # 格式:

    # - 标签名: xxxxx

    tag_per_img:
  7. category目录页横幅图片

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # 如果分类页面没有设置横幅,则显示顶部图片

    # 注意:分类页面,不是分类页面(子分类页面的顶部图片)

    category_img:

    # 具体分类页面的横幅图片,可以为不同的category设置不同的横幅图片

    # 格式:

    # - 分类名: xxxxx

    category_per_img:
  8. 文章统一封面

    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
    # 封面

    cover:

    # 是否显示文章封面

    index_enable: true

    aside_enable: true

    archives_enable: true

    # 首页封面显示的位置

    position: both # left/right/both

    # 当没有设置封面时,显示默认封面

    default_cover:

    # 当配置多张图片时,会随机选择一张作为 cover. 此时写法为

    - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg

    - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg

    - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg

    - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg

    - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg

    如果需要为每一篇文章设置不同的封面,可以在文章的md文件中添加配置。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    ---

    title: Hello World

    tags: [hello]

    categories:

    description: hello word~

    top_img: /img/hello-1.png

    cover: /img/hello-1.png

    ---
  9. 错误页面

    配置了该属性后会替换无法展示的图片

    1
    2
    3
    4
    5
    6
    7
    # 替换无法显示的图片

    error_img:

    flink: /img/friend_404.gif

    post_page: /img/404.jpg

3.9 图片懒加载

  1. 新增hexo-lazyload-image模块

    1
    npm install hexo-lazyload-image --save
  2. 编辑**站点配置文件**(_config.yml)增加配置:

    1
    2
    3
    4
    5
    lazyload:

    enable: true

    loadingImg: /img/loading.gif

    在图片没加载出来的时候,出现一个动图转动的图片样式。

3.10 图片大图查看

编辑 themes/butterfly/_config.yml,修改以下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 图片大图查看模式

# --------------------------------------

# 只能选择一个,或者两个都不选

# medium-zoom

# https://github.com/francoischalifour/medium-zoom

medium_zoom: false

# fancybox

# https://fancyapps.com/fancybox/

fancybox: true

注意:这两个选项只能二选一或者不选

3.11 版权样式

编辑 themes/butterfly/_config.yml,修改以下内容:

  1. 复制的内容后面加上版权信息
1
2
3
4
5
6
7
8
9
copy:

enable: true

copyright:

enable: false

limit_count: 50
  1. 文章版权信息

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # 文章版权

    post_copyright:

    enable: true

    decode: true

    author_href:

    license: CC BY-NC-SA 4.0

    license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/

    效果图:

    image-20240726002835343

3.12 相关文章

效果图:

image-20240726003029032

在文章最下面出现相关文章推荐。

编辑 themes/butterfly/_config.yml

1
2
3
4
5
6
7
related_post:

enable: true

limit: 6

date_type: created

3.13 打赏

效果图:

image-20240726003341192

给文章结尾设置打赏按钮,可以放上收款二维码。

编辑 themes/butterfly/_config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 赞助/打赏

reward:

enable: true

text:

QR_code:

- img: /img/wechat.png

link:

text: wechat

- img: /img/alipay.png

link:

text: alipay

3.14 侧边栏样式

编辑 themes/butterfly/_config.yml

  1. 调整侧边栏出现位置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    aside:

    enable: true

    hide: false

    button: true

    mobile: true # 在移动设备上显示

    position: right # left or right
  2. 个人信息

    1
    2
    3
    4
    5
    social:

    fab fa-github: https://github.com/xxxxx || Github || '#24292e'

    fas fa-envelope: mailto:xxxxxx@gmail.com || Email || '#4a7dbe'

    效果图:

    image-20240726003807888

3.15 公告栏设置

效果图:

image-20240726003941853

编辑 themes/butterfly/_config.yml

1
2
3
4
5
card_announcement:

enable: true

content: 这是我的博客

3.16 Toc目录

效果图:

image-20240726004047129

编辑 themes/butterfly/_config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
toc:

post: true

page: false

number: true

expand: false

style_simple: false

scroll_percent: true

3.17 字数统计

效果图:

image-20240726004256247

  1. 安装统计组件

    1
    npm install hexo-wordcount --save or yarn add hexo-wordcount
  2. 编辑 themes/butterfly/_config.yml

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    # 字数统计

    # 见 https://butterfly.js.org/posts/ceeb73f/#字数统计

    wordcount:

    enable: true

    post_wordcount: true

    min2read: true

    total_wordcount: true

3.18 文章分享功能

share.jsaddtoany二选一开启。

编辑 themes/butterfly/_config.yml

1
2
3
4
5
6
7
8
9
10
11
sharejs:

enable: true

sites: facebook,twitter,wechat,weibo,qq

addtoany:

enable: false

item: facebook,twitter,wechat,sina_weibo,facebook_messenger,email,copy_link

效果图:

Share.js

image-20240726004517874

AddToAny

image-20240726004610810

3.19 背景特效/美化

编辑 themes/butterfly/_config.yml

1. 鼠标点击效果

有烟火特效、爱心特效、文字特效,选择其中一个将enable设置为true就可以。

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
fireworks:

enable: false

zIndex: 9999

mobile: false

click_heart:

enable: false

mobile: false

clickShowText:

enable: false

text:

fontSize: 15px

random: false

mobile: false

2. 打字效果

1
2
3
4
5
6
7
8
9
activate_power_mode:

enable: false

colorful: true

shake: true

mobile: false

3. 背景特效

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
# canvas_ribbon (静止彩带背景)

# 见: https://github.com/hustcc/ribbon.js

canvas_ribbon:

enable: false

size: 150

alpha: 0.6

zIndex: -1

click_to_change: false

mobile: false

# Fluttering Ribbon (动态彩带)

canvas_fluttering_ribbon:

enable: false

mobile: false

# canvas_nest

# https://github.com/hustcc/canvas-nest.js

canvas_nest:

enable: false

color: '0,0,255' # 线条的颜色,默认: '0,0,0';RGB 值:(R,G,B)。(注意:用 ',' 分隔)

opacity: 0.7 # 线条的透明度 (0~1),默认: 0.5

zIndex: -1 # 背景的 z-index 属性,默认: -1

count: 99 # 线条的数量,默认: 99

mobile: false

4. 自定义背景主题色

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
# 美化/效果

# --------------------------------------

# 自定义主题颜色

# 注意:颜色值必须用双引号引起来,如 "#000",否则可能会导致错误!

# theme_color:

# enable: true

# main: "#49B1F5"

# paginator: "#00c4b6"

# button_hover: "#FF7242"

# text_selection: "#00c4b6"

# link_color: "#99a9bf"

# meta_color: "#858585"

# hr_color: "#A4D8FA"

# code_foreground: "#F47466"

# code_background: "rgba(27, 31, 35, .05)"

# toc_color: "#00c4b6"

# blockquote_padding_color: "#49b1f5"

# blockquote_background_color: "#49b1f5"

# scrollbar_color: "#49b1f5"

# meta_theme_color_light: "ffffff"

# meta_theme_color_dark: "#0d0d0d"

5. 渐变背景

默认显示白色,可设置图片或者颜色

1
2
3
4
5
6
7
# 设置网站背景

# 可以设置为颜色或图片(可设置图片 或者 颜色)

# 图片格式:url(http://xxxxxx.com/xxx.jpg)

background:

增加背景渐变色步骤:

  1. themes/butterfly/source/css/目录下创建css文件 background.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
    #web_bg {

    background: -webkit-linear-gradient(

    0deg,

    rgba(247, 149, 51, 0.1) 0,

    rgba(243, 112, 85, 0.1) 15%,

    rgba(239, 78, 123, 0.1) 30%,

    rgba(161, 102, 171, 0.1) 44%,

    rgba(80, 115, 184, 0.1) 58%,

    rgba(16, 152, 173, 0.1) 72%,

    rgba(7, 179, 155, 0.1) 86%,

    rgba(109, 186, 130, 0.1) 100%

    );

    background: -moz-linear-gradient(

    0deg,

    rgba(247, 149, 51, 0.1) 0,

    rgba(243, 112, 85, 0.1) 15%,

    rgba(239, 78, 123, 0.1) 30%,

    rgba(161, 102, 171, 0.1) 44%,

    rgba(80, 115, 184, 0.1) 58%,

    rgba(16, 152, 173, 0.1) 72%,

    rgba(7, 179, 155, 0.1) 86%,

    rgba(109, 186, 130, 0.1) 100%

    );

    background: -o-linear-gradient(

    0deg,

    rgba(247, 149, 51, 0.1) 0,

    rgba(243, 112, 85, 0.1) 15%,

    rgba(239, 78, 123, 0.1) 30%,

    rgba(161, 102, 171, 0.1) 44%,

    rgba(80, 115, 184, 0.1) 58%,

    rgba(16, 152, 173, 0.1) 72%,

    rgba(7, 179, 155, 0.1) 86%,

    rgba(109, 186, 130, 0.1) 100%

    );

    background: -ms-linear-gradient(

    0deg,

    rgba(247, 149, 51, 0.1) 0,

    rgba(243, 112, 85, 0.1) 15%,

    rgba(239, 78, 123, 0.1) 30%,

    rgba(161, 102, 171, 0.1) 44%,

    rgba(80, 115, 184, 0.1) 58%,

    rgba(16, 152, 173, 0.1) 72%,

    rgba(7, 179, 155, 0.1) 86%,

    rgba(109, 186, 130, 0.1) 100%

    );

    background: linear-gradient(

    90deg,

    rgba(247, 149, 51, 0.1) 0,

    rgba(243, 112, 85, 0.1) 15%,

    rgba(239, 78, 123, 0.1) 30%,

    rgba(161, 102, 171, 0.1) 44%,

    rgba(80, 115, 184, 0.1) 58%,

    rgba(16, 152, 173, 0.1) 72%,

    rgba(7, 179, 155, 0.1) 86%,

    rgba(109, 186, 130, 0.1) 100%

    );

    }
  2. themes/butterfly/_config.yml中添加样式文件引入

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    # 注入

    # 在头部 ('<head>' 标签之前) 和底部 ('<body>' 标签之前) 插入代码

    # 在头部 <head> 之前 和 底部 <body> 之前插入代码

    inject:

    head:

    - <link rel="stylesheet" href="/css/background.css">

    bottom:

    # - <script src="xxxx"></script>
  3. 如果背景色不生效,在_config.butterfly.yml设置:

    1
    2
    3
    4
    5
    6
    7
    # 设置网站背景

    # 可以设置为颜色或图片(可设置图片 或者 颜色)

    # 图片格式:url(http://xxxxxx.com/xxx.jpg)

    background: '#efefef'

footer 的背景,当设置 false 时,将与主题色一致。

1
2
3
# 页脚背景

footer_bg: true

————————————————
原文链接:https://blog.csdn.net/2301_76884890/article/details/141507802