hexo-blog
基于hexo搭建的博客 详细文档请参考官网
安装
1 | npm install hexo-cli -g |
修改网站信息
1 | # Site |
创建新文章
1 | hexo new 'My new Post' |
将会生成/source/_posts/My-new-Post.md
文件,内容如下:1
2
3
4
5---
title: My new Post //文章列表标题 网页<title>
date: 2016-03-09 15:59:25
tags:
---
生成public静态资源(网站的实际内容)
1 | hexo generate |
删除public目录使用hexo clean
发布
修改_config.yml1
2
3
4
5deploy:
type: git
repo: <repository url>
branch: [branch]
message: [message]
安装发布插件1
npm install hexo-deployer-git --save
发布1
hexo deploy
npm scripts
clean + generate + deploy
package.json中加入1
2
3
4
5"scripts":{
"deploy":"hexo clean && hexo generate && hexo deploy",
"push":"git add --all && git commit -m 'blog update' && git push origin master",
"done":"npm run push && npm run deploy"
}
使用方法1
2
3
4
5
6发布
npm run deploy
提交
npm run push
提交并发布:
npm run done
注:如果项目没有任何更改,调用npm run push命令会报错