依赖

1
2
git --version
node --version

一键启动

1
npm install hexo && npx hexo init blog && cd blog && npm un hexo-theme-landscape && npm i hexo-theme-butterfly hexo-renderer-pug && sed 's/landscape/butterfly/g' _config.yml > _config.yml.tmp && mv _config.yml.tmp _config.yml && curl -o _config.butterfly.yml https://cdn.jsdelivr.net/gh/jerryc127/hexo-theme-butterfly/_config.yml && npx hexo clean && npx hexo server

http://localhost:4000/

普通安装

一键启动的分解

hexo&&butterfly安装

1
2
3
npm install hexo #mac全局安装有权限问题,所以使用非全局
npx hexo init blog #初始化
cd blog #进入博客根目录

butterfly安装

1
2
npm un hexo-theme-landscape #卸载默认主题
npm i hexo-theme-butterfly hexo-renderer-pug #安装bf主题和渲染器

hexo配置

blog/_config.ymltheme: landscape改成下面

1
theme: butterfly #修改默认主题

使用代码

1
sed 's/landscape/butterfly/g' _config.yml > _config.yml.tmp && mv _config.yml.tmp _config.yml

预览

1
npx hexo clean && npx hexo server #清理和启动主题

http://localhost:4000/

主题配置下载

1
curl -o _config.butterfly.yml https://cdn.jsdelivr.net/gh/jerryc127/hexo-theme-butterfly/_config.yml

配置修改

hexo配置

blog/_config.yml里修改,https://hexo.io/zh-cn/docs/configuration

主题配置

blog/_config.butterfly.yml里修改,https://butterfly.js.org

卸载Hexo

1
2
3
#npm uninstall hexo-cli -g
#npm uninstall hexo-cli
npm un hexo

参考

https://github.com/hexojs/hexo

https://github.com/jerryc127/hexo-theme-butterfly

https://hexo.io/zh-cn/docs/configuration

https://butterfly.js.org/

https://hexo.io/zh-cn/docs/