hexo 搭建方法
本文以winddows系统安装hexo博客框架为例

一、hexo本地安装

二、提交到github仓库

三、最轻便,最美主题安装,以及优质主题推荐

第一部分
1、安装环境node.js

安装时注意添加路径

https://nodejs.org/en/

2、安装git bash

https://git-scm.com/download/win

3、在 git bash 中输入以下命令开始全局安装 Hexo

npm install -g hexo-cli

在 git bash 中输入

hexo init 自定义博客名(会生成自定义文件夹)

在 git bash 中输入hexo g ,编译静态文件到public文件夹,这是根目录会自动生成public文件夹

hexo g 

在 git bash 中输入hexo s,启动本地预览,关闭gitbash后,就无法预览

hexo s

输入 http://localhost:4000 ,能正常访问,则启动成功

第二部分
3、将hexo代码提交到github仓库,

注册github.com账号

新建一个github仓库

3.1、生成SSH密钥

在 git bash 中输入如下命令

git config --global user.name "你的GitHub用户名"


git config --global user.email "你注册github的邮箱"

生成密匙命令

ssh-keygen -t rsa -C "你注册github的邮箱"

在本地电脑中找到新生成的公匙,复制id_rsa.pub中的内容

找到github个人图像

设置-SSH and GPG keys-New SSH Key-粘贴公钥

验证是否成功

输入命令

ssh -T git@github.com

第三部分
安装butterfly主题(主题推送到github上会有坑)

https://butterfly.js.org/

根目录下git bash 输入命令

git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly

安装渲染器

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

修改 Hexo 根目錄下的 _config.yml,把主題改為 butterfly

theme: butterfly

清理缓存,重新生成静态文件,测试一下看看是否成功

hexo clean && hexo g 

参考链接: 520解说hexo博客搭建教程