hexo|Butterfly主题更换字体

创建font文件夹

themes/butterfly/source/下创建font文件夹

HarmonyOS_Sans_SC_Regular.ttfJetBrainsMono-Regular.ttf放进font

创建css

themes/butterfly/source/css/下创建font.css

编辑font.css

1
2
3
4
5
6
7
8
9
10
11
12
13
@font-face{
font-family: 'JetBrains Mono';
font-display: swap;
src: url('../font/JetBrainsMono-Regular.ttf') format("truetype");
}
@font-face{
font-family: 'HarmonyOS Sans SC';
font-display: swap;
src: url('../font/HarmonyOS_Sans_SC_Regular.ttf') format("truetype");
}
body {
font-family: 'JetBrains Mono','HarmonyOS Sans SC';
}

编辑_config.butterfly.yml

1
2
3
4
5
6
7
8
9
# Inject
# Insert the code to head (before '</head>' tag) and the bottom (before '</body>' tag)
# 插入代码到头部 </head> 之前 和 底部 </body> 之前
inject:
head:
# - <link rel="stylesheet" href="/xxx.css">
- <link rel="stylesheet" href="/css/font.css">
bottom:
# - <script src="xxxx"></script>