从零开始搭建 Hexo 博客,并安装Butterfly 主题。
✨ 前置条件
- 安装了 Node.js(推荐 v16.x 或以上)
- 安装了 Git
- 基本的终端操作能力
1️⃣ 安装 Hexo
1 2 3 4 5 6 7
| npm install -g hexo-cli hexo init my-blog cd my-blog npm install hexo server cd my-blog/themes git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git butterfly
|
然后编辑根目录的 _config.yml 文件:
1 2 3
| npm install hexo-renderer-pug hexo-renderer-stylus --save vi themes/butterfly/_config.yml hexo new "Hello Hexo"
|
本地预览 + 生成部署
1 2 3 4 5
| hexo clean hexo generate hexo server npm install hexo-deployer-git --save
|
在 _config.yml 添加
1 2 3 4
| deploy: type: git repo: https://github.com/用户名/仓库.git branch: gh-pages
|
1
| hexo clean && hexo g && hexo d
|
然后访问 https://用户名.github.io 即可看到博客