搭建Hexo博客
安装node.js
node官网下载

安装git
- 使用homebrew安装
安装homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装gitbrew install git
安装hexo
sudo npm install -g hexo
新建Hexo文件夹-cd到该文件夹下
hexo init
生成静态页面
hexo generate
开启本地服务器
hexo server

打开浏览器打开该网址

停止本地服务器
control + C
github上创建repository
命名方式username.github.io
安装git部署器
Could not install /Users/Karen/Hexo/ --save
进入之前创建的Hexo文件夹打开_config.yml文件
在末尾修改如下KarenRen/KarenRen修改为你的用户名

注意格式!!
部署
hexo deploy
输入用户名密码

打开https://username.github.io/

完成!!
接下来界面太丑我们来更换主题,很简单,首先将选好的主题克隆下来,更改配置文件_config.yml就可以了。
克隆到Hexo->themes文件下
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
修改配置具体见yilia博客
hexo-theme-yilia

这样配置完成后每篇文字全部显示,不够简洁,想要做成目录的样子,也就是每篇文章只显示部分怎么办。
在md文件中加入这样
以后的部分会被隐藏,点击题目,会进入到http://localhost:4000/2016/11/17/hello-world/
该文件下,也就是配置文件设置的permalink: :year/:month/:day/:title/
格式。

如果想要添加标签例如:

很简单,在md文件中添加如下内容即可


常见问题汇总:
Hexo d部署的时候ERROR
提示ERROR Deployer not found: git
两种情况:
- Hexo 3.0之后deploy的type 的github需要改成git
- 可能像我一样重新init Hexo 丢失了git
总之执行npm install hexo-deployer-git --save
即可
网友评论