Hexo安装butterfly主题
下载butterfly主题
git-bash进入到hexo目录,执行git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
-b是指定分支的意思。
注意:
如果想要通过github或者vercel自动发布的话,且便于后续主题的升级,可以使用git submodule来管理主题这个子仓库。因为作者的仓库我们没有push的权限,所以最好从主题的源仓库fork一份到自己的账号下,以便于一些对主题的自定义修改能够得以保留。命令如下:git submodule add https://github.com/XXXXXX(自己账号名)/hexo-theme-butterfly themes/butterfly
应用主题
修改Hexo根目录的_config.yml,搜索theme字段,将默认的landscape改为butterfly
新建主题butterfly专用配置文件
在hexo目录下拷贝一份../theme/_config.yml,并重命名为_config.butterfly.yml。
hexo会自动合并theme目录下_config.yml和hexo目录下_config.butterfly.yml里的配置,并且_config.butterfly.yml的优先级高。
安装插件
这里用到了pug和stylus的渲染器,需要安装对应的插件。执行npm install hexo-renderer-pug hexo-renderer-stylus --save
之后清理缓存,重新生成一份静态文件,执行hexo clean
hexo g
hexo s
就可以通过http://localhost:4000 看到效果了😊。
参考
hexo安装和自动部署
在 hexo 中使用 git submodules 管理主题
使用 submodule 管理 Hexo 主题