使用Hexo搭建博客! 可以查看 documentation
本文就是用搭建博客时自动创建的第一篇博客, 记录一些常用命令, 以便快速查阅.
安装配置 hexo
安装 Hexo 以及NexT 主题
1
2
3
4
5
6
7npm install hexo-cli -g
mkdir blog
cd blog
hexo init blog
npm install
git clone https://github.com/iissnan/hexo-theme-next themes/next
hexo server生成标签, 分类, 归档文件夹
1
2
3hexo new page "tag"
hexo new page "categoris"
hexo new page "archives"分别打开上面生成文件夹中的 index.md 文件
添加1
2
3
4
5---
title: tag
date: 2017-03-28 20:40:03
type: "tag"
---修改配置文件 _config.yml 和 themes/next/_config.yml* 文件, 详见
创建发布文章
Create a new post 创建文章
将文章创建在source/_posts
目录下
使用hexo generate
时将文章生成在public
目录下
使用hexo deploy
将文章部署到 GitHub1
$ hexo new "My New Post"
More info: Writing
Run server 本机预览文章
1
$ hexo server
More info: Server
Generate static files 生成文章
为部署到服务器上而生成 HTML 文件1
$ hexo generate
More info: Generating
Deploy to remote sites 发布文章
在配置文件中配置部署到何处1
$ hexo deploy
创建草稿
Create a new draft 创建草稿
将文件建立在source/_draft
目录中
hexo generate
不会生成相应 HTML 文件1
$ hexo new draft "My New Draft"
Run server 本机预览草稿
1
$ hexo server --draft
Generate draft 将草稿发布为正式文章
1
$ hexo publish "My New Draft"