Hexo-Butterfly配置安装

1.安装配置Git

1
2
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"

2.安装配置Node.js

2.1安装包管理器mvn

https://github.com/coreybutler/nvm-windows/releases

安装目录root下在settings.txt文件新增镜像加速

1
2
node_mirror: https://npmmirror.com/mirrors/node/
npm_mirror: https://npmmirror.com/mirrors/npm/

2.2安装Node.js包

查看版本列表

1
nvm list available

推荐安装LTS(长期支持版本)

1
nvm install <version>

使用对应选择的version

1
nvm use <version>

2.3测试

1
2
node -v
npm -v

3.安装Hexo

1
npm install -g hexo-cli

4.初始化

4.1新建仓库

cd 到需要创建仓库的位置

1
hexo init blog-demo

此命令在当前文件夹生成blog-demo文件夹

blog-demo文件夹里是新建成的仓库

4.2初次启动Hexo

1
2
3
cd blog-demo
npm i
hexo s

将在 http://localhost:4000/ 部署页面

5.部署到github.io

5.1git连接远端仓库

1
2
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
cat ~/.ssh/id_rsa.pub (内容拷贝至github ssh-key)

新建个人github.io网站仓库

Your repo: 使用https或ssh链接

5.2修改_config.yml文件

1
2
3
4
deploy:
type: git
repository: <Your repo>
branch: main

5.3部署

1
2
npm install hexo-deployer-git --save
hexo clean && hexo generate && hexo deploy

6.配置butterfly主题

6.1clone 主题butterfly

1
2
cd node_modules
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git hexo-theme-butterfly

可拉取更新

1
git pull

6.2应用主题

修改_config_yml

1
theme: butterfly

安装 pug 以及 stylus 的渲染器

1
npm install hexo-renderer-pug hexo-renderer-stylus --save

在根目录下新建一个_config.butterfly.yml文件

把主题文件夹里_config.yml文件内容复制进去

_config.landscape.yml可删除

7. 维护

7.1 本地测试

1
hexo cl; hexo g; hexo s

7.2 重新部署

1
hexo cl; hexo g; hexo d

参考

https://www.fomal.cc/posts/3451f874.html

https://butterfly.js.org/posts/dc584b87/