Hexo-theme-next 插件使用总结

虽然 hexo-theme-next 的主题很好看,但是我们总是想着弄一些跟别人不一样的;那这就需要依赖其他各种依赖插件,或者之际编写个性化样式,在原有的主题框架下,加入自己想要的东西。

_config.yml 是站点配置文件;_config.next.yml 是主题配置文件。

Plugins Version
hexo-deployer-git 3.0.0
hexo-cake-moon-menu 2.5.0
hexo-next-fireworks 1.1.0
hexo-word-counter 0.0.3
hexo-related-posts 1.5.0
hexo-filter-mathjax 0.8.0
hexo-generator-searchdb 1.4.0
hexo-abbrlink 2.2.1
hexo-related-popular-posts 弃用
hexo-helper-live2d 3.1.1

0. hexo-deployer-git — 一键部署插件

  • hexo-deployer-git
1
npm install hexo-deployer-git
  • _config.yml
1
2
3
4
deploy:
type: git
repo: [填写自己的 Github 仓库号] # or https://gitee.com/<yourAccount>/<repo>
branch: master

1. hexo-cake-moon-menu — 向上图标

  • hexo-cake-moon-menu

安装插件

1
npm install hexo-cake-moon-menu

修改站点配置文件

  • _config.yml — 在合适的地方添加以下内容
1
2
3
4
5
6
7
8
9
moon_menu:
back2top:
enable: true
icon: fas fa-chevron-up
order: -1
back2bottom:
enable: true
icon: fas fa-chevron-down
order: -2

2. hexo-next-fireworks — 鼠标点击效果

  • hexo-next-fireworks
1
2
3
npm install next-theme/hexo-next-fireworks
hexo clean
hexo s

无需修改配置文件,清除缓存之后直接生效。

3. hexo-word-counter — 文章字数统计

  • hexo-word-counter
1
npm install hexo-word-counter --save
  • _config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
symbols_count_time:
symbols: true
time: true
total_symbols: true
total_time: true
awl: 4 ## 平均字长
wpm: 275 ## 每分钟阅读字数
# symbols: true ## post meta 显示字数
# time: true ## post meta 显示时长
# total_symbols: true ## 在页脚处显示所有帖子字数
# total_time: true ## 在页脚处显示所有帖子的阅读时长
# awl: 4 ## 平均字长
# wpm: 275 ## 每分钟阅读字数
  • _config.next.yml
1
2
3
symbols_count_time:
separated_meta: true
item_text_total: false ## 页脚处显示字数与阅读时间
  • hexo-related-posts
1
npm install hexo-related-posts --save
  • _config.next.yml
1
2
3
4
related_posts:
enable: true
title: 相关帖子 # Custom header, leave empty to use the default one
display_in_home: false ## 是否在主页显示相关帖子

5. hexo-filter-mathjax — 数学公示渲染

  • hexo-filter-mathjax
1
npm install hexo-filter-mathjax
  • _config.next.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
math:
# Default (false) will load mathjax / katex script on demand.
# That is it only render those page which has `mathjax: true` in front-matter.
# If you set it to true, it will load mathjax / katex script EVERY PAGE.
every_page: false ## 是否在每一个页面使用

mathjax:
enable: true
# Available values: none | ams | all
tags: none

katex:
enable: false
# See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex
copy_tex: false

6. hexo-generator-searchdb — 本地搜索

  • hexo-generator-searchdb
1
npm install hexo-generator-searchdb
  • _config.yml
1
2
3
4
5
6
## search 
search:
path: search.xml
field: post
content: true
format: html
  • _config.next.yml
1
2
3
4
5
6
7
8
9
10
11
local_search:
enable: true
# If auto, trigger search by changing input.
# If manual, trigger search by pressing enter key or search button.
trigger: auto
# Show top n results per article, show all results by setting to -1
top_n_per_article: 1
# Unescape html strings to the readable one. 转义
unescape: true
# Preload the search data when the page loads. 预加载
preload: true
  • hexo-abbrlink
1
npm install hexo-abbrlink
  • _config.yml
1
2
3
4
5
6
7
8
url: https://zerobio.github.io  ## 这里换成自己的域名
root: /
permalink: archives/:abbrlink.html
## 设置文章永久链接
abbrlink:
alg: crc32 # 算法:crc16(default) and crc32
rep: hex # 进制:dec(default) and hex
permalink_defaults:
  • hexo-related-popular-posts
1
npm install hexo-related-popular-posts --save
  • _config.next.yml
1
2
3
4
5
6
7
8
9
10
related_posts:
enable: true
title: 推荐文章 # Custom header, leave empty to use the default one
display_in_home: false
params:
maxCount: 5
PPMixingRate: 0.25
isDate: false
isImage: false
isExcerpt: false

9. hexo-helper-live2d — 宠物插件

关于这个插件,我专门出了一篇文章,详情请移步:https://zerobio.github.io/archives/c03b7d36.html

参考链接

[1] https://tding.top/archives/761b6f4d.html