使用hexo搭建博客的简单流程

1. hexo是什么?

​ 一个快速、简介并且高效的博客框架

​ 官网: https://hexo.io/zh-cn/

2. 基本使用流程

1
2
3
4
5
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo server

注意: hexo是用markdown编写的,需要基于node和git,所以在安装前,确保电脑上已经拥有node和git了

3.发布到github上

​ 在_config.yml最后添加:

1
2
3
4
deploy:
type: git
repo: https://github.com/itstrive/itstrive.github.com.git
branch: master

然后:

1
2
hexo g //生成静态文件
hexo d //发布

4. 发表一篇文章

1
2
3
4
5
1. 在git bash里面运行 hexo new 'my_post'
2. 在source\_post\my_post.md 打开,然后编写
3. hexo g //生成静态文件
hexo s //在本地预览
hexo d //发布到github上

5. 更换主题

1
2
3
4
5
主题: https://hexo.io/themes/
随便找一个主题,下载下来,放到themes目录下
并且更改
_config.yml
theme: 换成themes目录下主题的名字

6.删除操作

1
2
3
4
5
6
7
8
删除一篇文章: 只要删除 source/_posts/xxx.md 即可
然后: hexo g
hexo d
备注:
hexo g == hexo generate#生成
hexo s == hexo server #启动服务预览
hexo d == hexo deploy#部署

注意: 如果出现报错 error deployer not found: git

需要安装: npm install hexo-deployer-git –save-dev

avatar

itstrive

javascrpit and html5 and nodeJs and so on...