hexo-butterfly美化
hexo博客一图流
实现效果展示
头部背景与主体部分背景无缝连接
实现方法
通过开启butterfly主题留下的inject模块功能
添加css代码
先在主题的css文件夹中创建custom.css文件1
cd themes/butterfly/source/css/
编辑让顶部背景和页脚背景透明的css文件
vim custom.css1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#footer {
background: transparent !important;
}
#page-header {
background: transparent !important;
}
#footer::before{
background: transparent !important;
}
#page-header::before{
background: transparent !important;
}
[data-theme="dark"] #footer::before{
background: transparent !important;
}
[data-theme="dark"] #page-header::before{
background: transparent !important;
}
_config.yml中开启inject部分功能
将head部分注释取消
更换背景
vim搜索背景,更换background1
vim /hexo/themes/butterfly/_config.yml
效果实现
启动hexo查看效果
1 | hexo clean |
刷新页面
文章封面
封面
修改部分为:1
2
3
4
5
6
7
8
9
10
11
12
13vim themes/butterfly/_config.yml
cover:
#display the cover or not (是否顯示文章封面)
index_enable: false #首页
aside_enable: false #侧边
archives_enable: false#归档
#the position of cover in home page (封面顯示的位置)
#left/right/both
position: both
#When cover is not set, the default cover is displayed (當沒有設置cover時,默認的封面顯示)
default_cover:
# - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg
分页
分页,也就是文章内中显示的下一页上一页按钮,可通过配置文章封面显示图片,也可以通过设置主题色改变其颜色。
置顶文章滚动页
NPM 插件安装
1 | npm i hexo-swiper-bar --save |
新增网站根目录_config 配置项 (不是主题的)
添加以下代码
1 | swiper: |
相关含义小冰老师解释的很详细
https://zfe.space/post/hexo-swiper.html
最后在文章中加入以下内容
1 | swiper_index: 8 |
最后一行可不写,默认使用文章封面
看板娘
添加代码
- 打开主题配置文件
\hexo\themes\butterfly\_config.yml,inject部分添加代码:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15inject:
head:
- <link rel="stylesheet" href="/css/custom.css">
bottom:
- |
<script src="https://cdn.jsdelivr.net/npm/live2d-widget@latest/lib/L2Dwidget.min.js"></script>
<script>
L2Dwidget.init({
model: {
jsonPath: 'https://raw.githubusercontent.com/iCharlesZ/vscode-live2d-models/master/model-library/girls-frontline/HK416-2/normal/model.json'
},
display: { position: 'right', width: 250, height: 320 },
mobile: { show: false }
});
</script>- 上面使用的是
HK416-2-normal,修改model的jsonpath即可修改看板娘
- 上面使用的是
- 看板娘开源项目GitHub 大合集
模型json
1 | # 22 |
主题色
修改以下内容即可1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19vim themes/butterfly/_config.yml
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"
隐藏首页文章
安装插件
卸载原版插件后安装社区插件1
2npm un hexo-generator-index -S
npm i hexo-generator-indexed -S
使用
文章中插入参数:1
2
3
4
5---
title: 这是一篇隐藏首页的文章
hide: true # 新增
date: 2025-07-26 12:00:00
---
三件套
1 | hexo cl |








