重构博客

重构博客
菠萝abbrlink: ‘0’
重构博客
1.Hexo的安装
注意:默认你安装了node,git,并且你有一个自己的Github账号呀。没有的话自行搜索安装一下。
更多详情可以参考官网Hexo
- 安装hexo的脚手架hexo-cli
npm install hexo-cli -g |
- 创建一个hexo博客
hexo init |
此时你可以本地启动查看一下
hexo generate |
默认的效果如下
2.选取主题anzhiyu
可以参官方的教程 https://github.com/anzhiyu-c/hexo-theme-anzhiyu
- 安装butterfly主题
在刚才的目录安装主题:
git clone -b main https://github.com/anzhiyu-c/hexo-theme-anzhiyu.git themes/anzhiyu |
- 应用主题
在Hexo的更目录下_config.yml,把主题修改一下butterfly
theme: anzhiyu |
- 安装插件
npm install hexo-renderer-pug hexo-renderer-stylus --save |
官方建议
在 hexo 的根目錄創建一個文件 _config.butterfly.yml,並把主題目錄的 _config.yml 內容複製到 _config.butterfly.yml 去。( 注意: 複製的是主題的 _config.yml ,而不是 hexo 的 _config.yml)
注意: 不要把主題目錄的 _config.yml 刪掉
注意: 以後只需要在 _config.butterfly.yml 進行配置就行。
如果使用了 _config.butterfly.yml, 配置主題的 _config.yml 將不會有效果。
Hexo會自動合併主題中的 _config.yml 和 _config.anzhiyu.yml 裏的配置,如果存在同名配置,會使用 _config.anzhiyu.yml 的配置,其優先度較高。
完成以上操作再次启动
- hexo clean
- hexo g
- hexo s
3.hexo SEO优化
依赖安装
- 配置文章连接跳转数字或字幕: https://github.com/rozbo/hexo-abbrlink
npm install hexo-abbrlink --save |
修改配置文件 _config.yml
permalink: posts/:abbrlink.html |
npm install hexo-generator-search --save |
添加配置 _config.yml
search: |
修改 _config.butterfly.yml,将local_search 修改成true
# Local search |
# 安装live2d |
4.部署到Github
pages.yml
name: Pages |
dependabot.yml
version: 2 |
这样子就可以通过idea上传到github上去了,注意创建的仓库名字要与你的github名字一样(name.github.io),例如: zhangsan.zhangsan.githun.io
5.美化博客
https://Kiritoabc.github.io |
(很多东西还没搞完,每天在弄背面试题,累死。