Butterfly 主题官方中文文档

本地搜索#

  • 安裝hexo-generator-search,格式只支持 xml
1
npm install hexo-generator-search --save
  • 修改主题配置文件
1
2
local_search:
enable: false

副标题打字机效果#

  • 修改主题配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# the subtitle on homepage (主頁subtitle)
subtitle:
enable: true
# Typewriter Effect (打字效果)
effect: true
# loop (循環打字)
loop: true
# source調用第三方服務
# source: false 關閉調用
# source: 1 調用搏天api的隨機語錄(簡體)
# source: 2 調用一言網的一句話(簡體)
# source: 3 調用一句網(簡體)
# source: 4 調用今日詩詞(簡體)
# subtitle 會先顯示 source , 再顯示 sub 的內容hex
source: 2
# 如果有英文逗號' , ',請使用轉義字元 ,
# 如果有英文雙引號' " ',請使用轉義字元 "
# 開頭不允許轉義字元,如需要,請把整個句子用雙引號包住
# 如果關閉打字效果,subtitle只會顯示sub的第一行文字
sub:
- 世界上只有一种英雄主义,就是看清生活的真相之后,依然热爱生活。

source 第三方接口的 相关配置参数可以在 ~butterfly\layout\includes\third-party\subtitle.pug文件中修改

RSS订阅#

  • 安装hexo-generator-feed插件
1
npm install hexo-generator-feed --save
  • 修改主题配置文件
1
2
3
4
5
# social settings (社交圖標設置)
# formal:
# icon: link || the description
social:
fas fa-rss: /atom.xml

樱花飘落效果#

文件准备:樱花飘落效果的 JS 文件

  • 将下载好的JS文件放在~\Butterfly\source\js文件夹下

  • ~\Butterfly\layout\includes文件夹下找到head.pug文件,在最后引入

1
2
if theme.sakura.enable
script(src="/js/sakura.js")
  • 在主题配置文件加入
1
2
3
# 页面樱花飘落动效
sakura:
enable: true

字数统计#

  • 安装hexo-wordcount插件
1
npm install hexo-wordcount --save
  • 修改主题配置文件
1
2
3
4
5
6
# wordcount (字數統計)
wordcount:
enable: true
post_wordcount: true
min2read: true
total_wordcount: true

生成唯一文章链接#

  • 安装hexo-abbrlink插件
1
npm install hexo-abbrlink --save
  • 修改 Hexo 配置文件
1
2
3
4
5
permalink: posts/:abbrlink.html
# abbrlink config
abbrlink:
alg: crc32 #算法: crc16(default) and crc32
rep: hex #进制: dec(default) and hex

生成的链接将如下所示

crc16 & hex
https://post.zz173.com/posts/66c8.html

crc16 & dec
https://post.zz173.com/posts/65535.html

crc32 & hex
https://post.zz173.com/posts/8ddf18fb.html

crc32 & dec
https://post.zz173.com/posts/1690090958.html

生成文章目录#

Hexo 默认不支持目录显示,可以安装需要的插件

  • 安装hexo-toc插件
1
npm install hexo-toc --save
  • 修改 Hexo 配置文件
1
2
3
4
5
6
7
8
9
toc:
maxdepth: 3
class: toc
slugify: transliteration
decodeEntities: false
anchor:
position: after
symbol: '#'
style: header-anchor