官方文档地址:https://hexo.io/zh-cn/docs/configuration
一、基本设置
1、启动主题
1、git clone主题到
hexo\blog\themes文件夹下2、修改
hexo\blog\_config.yml文件1
2
3
4# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: hexo-theme-next3、在根目录打开命令行输入
hexo s查看效果
2、更改主题为中文
修改hexo\blog\_config.yml文件
1 | language: zh-CN |
3、增加标签页和分类页
- 修改主题的配置文件
hexo\blog\themes\hexo-theme-next\_config.yml
1 | menu: |
- 创建标签页
在hexo根目录执行hexo n page tags会在hexo\blog\source路径下生成tags文件夹,修改里面的index.md文件
1 | --- |
- 创建分类页
在hexo根目录执行hexo n page categories会在hexo\blog\source路径下生成categories文件夹,修改里面的index.md文件
1 | --- |
4、主题样式更改
修改主题配置文件
1 |
|
设置头像
1 |
|
更改作者标题链接
hexo主配置文件
1 | # site |
主题配置文件
1 | # Social Links |
5、新建一篇博客
1 | hexo n "第一篇博客" |
编辑hexo\blog\source\_posts\第一篇博客.md添加分类和标签
1 | --- |
6、开启打赏功能
1 |
|
二、常见问题
1、安装完成之后出现警告 Warning: Accessing non-existent property ‘lineno’ of module exports inside circular dependency
- 原因:当前node版本为14.16,切换为12.X
2、busuanzi_count失效
1 | <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script> |
3、中文锚点失效
在post-details.js文件中找到
1 | var targetSelector = NexT.utils.escapeSelector(this.getAttribute('href')); |
4、分页按钮不正常显示
1 | 找到pagination.ejs,添加一句escape: false |