人生苦短,我用butterfly。相比于其他的主题,butterfly主题相当成熟。按照其官网文档就可以将博客配置的非常漂亮。

主题安装

https://butterfly.js.org/posts/21cfbf15/ ,完全可以参考主题官网的文档进行。

1
2
3
4
5
6
7
8
9
$ cd myblog
# pnpm 要远比npm效率高
$ pnpm install hexo-theme-butterfly
# 命令行配置主题
$ hexo config theme butterfly
$ pnpm install hexo-renderer-pug hexo-renderer-stylus --save
# 将_config.yml复制给_config.butterfly.yml
$ cp _config.yml _config.butterfly.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
# 使用中文简体字
language: zh-CN

# 打开搜索选项
search:
# Choose: algolia_search / local_search / docsearch
# leave it empty if you don't need search
use: local_search

# 设置头像和首页等处的背景图
avatar:
img: /img/biubiubiu.gif
effect: false

# Disable all banner images
disable_top_img: false

# If the banner of page not setting, it will show the default_top_img
default_top_img: /img/top_img2.png

# The banner image of index page
index_img:

# The banner image of archive page
archive_img: /img/top_img1.jpg

# Note: tag page, not tags page
tag_img: /img/top_img4.png

要在博客目录底下的source目录中新建img文件夹,把对应的图片放入到img文件夹内就可以达到图片设定效果。

生成目录和标签

1
2
3
4
5
# 1. 创建标签页面
$ hexo new page tags

# 2. 创建分类页面
$ hexo new page categories

然后去打开source/categories/index.md,在文件格式中加入type: categories。去打开source/tages/index.md,在文件格式中加入type: categories。

1
2
3
4
# 清除缓存,然后重新生成并运行
$ hexo clean
$ hexo g
$ hexo s