欢迎来到 我的个人博客! ,这是我的第一篇文章。本博客使用Hexo工具生成,查看 documentation 获取最新的信息。如果您在使用hexo的过程中遇到任何问题, 您可以在 troubleshooting 上面找到答案,或者您可以在官方GitHub上面留言。

快速开始

安装hexo,安装前请检查是否已安装node.js、git

1
$ sudo npm install hexo-cli -g

安装hexo完成后,执行以下命令,hexo将会在指定文件夹中新建所需要的文件

1
2
3
$ hexo init <folder> //如 hexo init blog
$ cd <folder> //如 cd blog
$ npm install

新建完成后,指定文件夹的目录如下

1
2
3
4
5
6
7
8
blog
├── _config.yml
├── package.json
├── scaffolds
├── source
| ├── _drafts
| └── _posts
└── themes

创建一篇新的文章

1
$ hexo new "my new post"  //缩写hexo n "my new post"

启动服务器

1
$ hexo server //缩写hexo s

生成静态文件

1
$ hexo generate //缩写hexo g,加上--watch,可以实时监听文件改动,自动更新

远程部署网站

首先,您得在_config.yml中配置所提交的远程仓库地址和目录

1
2
3
4
5
6
7
8
9
10
11
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yourname.github.io/
root: /

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: git@github.com:yourname/yourname.github.io.git
branch: master

1
$ hexo deploy //缩写hexo d

更多信息,请查看官方API文档 [英文中文]