安装完 hexo 之后,进入网站文件夹,用 npm 方式安装
$ cd hexo-site
$ npm install hexo-theme-next
打开 hexo 配置文件,将 theme 改为 next
theme: next
next theme 配置文件路径
ode_modules/hexo-theme-next/_config.yml
浏览页面显示当前浏览进度
打开 themes/next/_config.yml,搜索关键字 scrollpercent,把 false 改为 true。
Local Search本地搜索
安装插件hexo-generator-searchdb,执行以下命令:
npm install hexo-generator-searchdb --save
修改hexo/_config.yml站点配置文件,新增以下内容到任意位置,注意,一定要有层级,用 tab 区分
search:
path: search.xml
field: post
format: html
limit: 10000
启用本地搜索
# Local search
local_search:
enable: true
代码块复制选项
Next6 中自带了复制代码按钮,Next5 需要自己手动配置。
搜索 codeblock,找到如下配置:
codeblock:
border_radius: 8 # 按钮圆滑度
copy_button: # 设置是否开启代码块复制按钮
enable: true
show_result: true # 是否显示复制成功信息
添加阅读次数,访问量等
修改 next 主题文件夹下的_config.yml文件
busuanzi_count:
enable: true
total_visitors: true
total_visitors_icon: user
total_views: true
total_views_icon: eye
post_views: true
post_views_icon: eye
字数统计和阅读时长
安装插件
npm install hexo-symbols-count-time --save
配置
symbols_count_time:
separated_meta: true #分隔线
item_text_post: true #文章中的显示是否显示文本
item_text_total: true #网页底部的显示是否显示文本
awl: 2 #平均每个字符的长度
wpm: 275 # 设定每分钟可阅读的字符数
symbols: true #是否统计字数
time: true #是否统计阅读时长
total_symbols: true #是否统计总字数
total_time: true #是否统计总阅读时长
主题的文章显示时的动画怎么去掉
修改主题配置,找到 use_motion 更改为 false
参考
https://github.com/next-theme/hexo-theme-next
https://theme-next.js.org/docs/getting-started/#Configuration-Files