我们简单使用butterfly主题之后,很明显当前主题的样式并不符合我们的要求,我们需要进行一定的配置。接下来我会介绍一些常用的配置

hexo配置文件修改

站点相关修改

1
2
3
4
5
6
7
8
我们打开_config.yml配置文件,找到其中的site
title: Hexo #站点的标题
subtitle: ''
description: ''
keywords:
author: Sadness Pineapple #作者,与导航栏中的作者相关
language: zh-Hans #语言
timezone: Asia/Shanghai #时区

上传相关

1
2
3
4
5
6
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git #使用什么上传
repo: git@github.com:a744740454/a744740454.github.io.git #你github的仓库,当你使用hexo d的时候上传的地址
branch: master #分支

主题相关配置修改

菜单相关

1
2
3
4
5
6
7
8
9
10
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 #说说

image-20210115200001654

网站图标相关

1
favicon: /img/favicon.png  

头像相关

1
2
3
avatar:
img: https://i.loli.net/2021/01/15/UCfNhvRid3xIVzS.jpg
effect: disabled #选true头像会一直转

顶部背景图

1
2
3
4
index_img: https://i.loli.net/2021/01/14/KU2VYXI9zrLEqJn.jpg #首页的背景图
# If the banner of page not setting, it will show the top_img
default_top_img: #默认的顶部图片
... #后续还有对应的不同页面的背景图

文章背景图相关

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cover:
# display the cover or not (是否顯示文章封面)
index_enable: true
aside_enable: true
archives_enable: true
# 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/2021/01/15/lNVkumjp6IiHGAr.jpg
- https://i.loli.net/2021/01/15/4pcGJhqNREwe6Ub.jpg
- https://i.loli.net/2021/01/15/l2huGSOCq6IY985.jpg
...