NexT主题安装
NexT主题官网: http://theme-next.iissnan.com/
最新版本NexT的GitHub地址: https://github.com/theme-next/hexo-theme-next
下载新的主题包
1
2
3cd C:\blog
git clone https://github.com/theme-next/hexo-theme-next themes/next修改Hexo的配置文件:_config.yml,更换theme为
next1
theme: next
重新生成
1
2
3
4cd C:\blog\
hexo clean
hexo g
hexo s重新刷新http://localhost:4000/ 网站查看结果。
升级:
NexT releases new versions every month. You can update to latest master branch by the following command:
1 | $ cd themes/next |
NexT主题设置
NexT主题官网: http://theme-next.iissnan.com/
NexT主题配置文件:C:\blog\themes\next\_config.yml
菜单设置(左侧栏)
启用About,Tags,Categories等菜单。
1 | menu: |
About页面设置
新建一个about页面:
1 | hexo new page "about" |
在blog/source下会生成一个新的文件夹about,在该文件夹下会有一个index.md文件。
头像设置
1 | # Sidebar Avatar |
Social设置
启用Social链接:
1 | social: |
链接设置
1 | links: |
创建“标签页”和“分类页”
1 | C:\blog>hexo n page tags |
Tags页设置:C:\blog\source\tags\index.md
1 | --- |
Categories页设置:C:\blog\source\categories\index.md
1 | --- |
增加搜索功能
Local Search 由 flashlab 贡献,添加百度/谷歌/本地 自定义站点内容搜索。
安装 hexo-generator-searchdb,在站点的根目录下执行以下命令:
1 | $ npm install hexo-generator-searchdb --save |
编辑 站点配置文件,新增以下内容到任意位置:
1 | search: |
编辑 主题配置文件,启用本地搜索功能:
1 | # Local search |
不蒜子统计
编辑 主题配置文件 中的busuanzi_count的配置项。
当enable: true时,代表开启全局开关。若site_uv、site_pv、page_pv的值均为false时,不蒜子仅作记录而不会在页面上显示。
隐藏网页底部强力驱动
编辑配置文件: C:\blog\themes\next\layout_partials\footer.swig
删除或注释掉footer.powered 相关项。
1 | <!-- |
实现统计功能(字数统计和阅读时长)
A. 适用于NexT老版本,最新版无效
在站点的根目录下执行以下命令:
1 | $ npm install hexo-wordcount --save |
主题配置文件
1 | post_wordcount: |
B. 适用于Hexo NexT v6.3.0 字数统计
安装插件 hexo-symbols-xount-time
- 卸掉你在史前教程里装的hexo-wordcount插件!
在站点的根目录下执行以下命令:
1 | npm uninstall hexo-wordcount |
- 然后安装新插件hexo-symbols-xount-time,在站点的根目录下执行以下命令:i 就是 install 的简写!
1
npm i hexo-symbols-count-time --save
设置 hexo-symbols-xount-time
- 首先在
站点配置文件夹下的配置文件里,拉到最后添加如下代码:
1 | symbols_count_time: |
- 然后在
主题配置文件,NexT 主题其实已经自带了相关代码,搜索wordcount或者插件名可以看到如下代码:awl(Average Word Length)的数值是设定多少字符统计为一个字(word),中文博客需要设置为 2。1
2
3
4
5
6
7
8#Post wordcount display settings
#Dependencies: https://github.com/theme-next/hexo-symbols-count-time
symbols_count_time:
separated_meta: true
item_text_post: true
item_text_total: false
awl: 2
wpm: 300
wpm(Words Per Minute)是你的阅读速度,多少字(word)统计为阅读时长一分钟。以下是官方文档里的一些阅读速度参考数据:
慢速:200
中速:275(默认)
快速:350
还有给中文用户的贴心提示:因为在中文中一个词语的平均长度在 1.5 字左右,所以一般建议设置为awl=2,wpm=300。
添加备案号
打开NexT主题目录下的 \themes\next\layout\_partials\footer.swig文件,在底部加入ICP备案号并链接至”https://beian.miit.gov.cn",如下:
<a href="https://beian.miit.gov.cn/">苏ICP备xxxxxx号</a>
把备案号换成自己的备案号即可。
Nginx部署:
ngnix配置文件:/usr/local/nginx/conf/nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html/public;
index index.html index.htm;
}HTML文件夹:/usr/local/nginx/html
把Hexo生成的静态文件夹:public上传至:/usr/local/nginx/htmlNginx启动
1
/usr/local/nginx/sbin/nginx
Nginx停止
1
killall nginx