写博客
hexo new
1
hexo new post title
post 一般可以省略
如果 title 中包含空格,则需要用双引号包含
hexo new post ‘New Blog’
执行后,会在
source/_post文件夹下生成一个new-Blog.md的文件编辑
编辑
new-Blog.md文件,书写博客内容发布
执行
hexo g生成静态页面执行
hexo s启动本地服务器查看效果执行
hexo d发布文章至Githubhexo d [-m “commit message”]
写草稿
1 | hexo new draft title |
新创建的草稿将保存到
source/_drafts文件夹中草稿默认不显示在页面中,可以通过执行上述命令时添加
--draft参数,或者把_config.yml中render_drafts参数设为true来预览草稿可以通过
publish命令将草稿移至source/_post文件夹中hexo publish draft title
删除博客
直接在
source/_post文件夹中删除对应的.md文件执行
hexo g和hexo d
添加标签
添加标签页
创建
tags页面1
hexo new page tags
编辑新创建的
tags页面,修改页面类型为tags,主题将自动为这个页面显示所有标签1
2
3
4title: 分类
date: 2017-11-03 14:25:07
type: "tags"
comments: false在菜单中添加链接,编辑主题的
_config.yml,去掉menu中tags: /tags的注释1
2
3
4
5menu:
home: /
categories: /categories
archives: /archives
tags: /tags
博客加标签
在
Front-matter区域中指定tags1
2
3
4
5tags: [label, label, label]
tags:
- label
- label
添加分类
添加分类页
创建
categories页面1
hexo new page categories
编辑新创建的
categories页面,修改页面类型为categories,主题将自动为这个页面显示所有分类1
2
3
4title: 分类
date: 2017-11-03 14:25:07
type: "categories"
comments: false在菜单中添加链接,编辑主题的
_config.yml,去掉menu中categories: /categories的注释1
2
3
4
5menu:
home: /
categories: /categories
archives: /archives
tags: /tags
博客加标签
在
Front-matter区域中指定categories1
2
3
4
5categories: [label, label, label]
categories:
- label
- label
关闭底部主题信息
将主题(
next)配置文件_config.yml中的以下字段设为false
1
2
3
4
5 footer:
powered: false
theme:
enable: false
version: false
统计
对博客的统计,可以通过 busuanzi 和 leancloud 实现
最新版本的
next主题支持上面两种方式,只需要修改配置文件_config.yml即可
1 | # leancloud |
1 | # busuanzi |
RSS 订阅
安装插件
1
npm install hexo-generator-feed --save
开启网站 RSS 支持
修改博客配置文件
_config.yml1
2
3
4
5
6
7
8
9# RSS
## Plugins: http://hexo.io/plugins/
plugin:
- hexo-generator-feed
#Feed Atom
feed:
type: atom
path: atom.xml
limit: 20开启主题 RSS 支持
不同主题开启方法不同,NexT 主题默认开启,其它主题参考对应的主题说明
生产 RSS
1
2hexo clean
hexo g
Gitment 评论
Gitment是一款基于GitHub Issues的评论系统。支持在前端直接引入,不需要任何后端代码。可以在页面进行登录、查看、评论、点赞等操作,同时有完整的 Markdown / GFM 和代码高亮支持。尤为适合各种基于 GitHub Pages 的静态博客或项目页面
注册 OAuth Application
注册一个新的 OAuth Application
callback URL对应的是博客域名注册成功之后将得到一个
Client ID和Client Secret

开启 Gitment
编辑主题配置文件
_config.yml文件1
2
3
4
5
6
7
8
9
10
11
12
13# Gitment
# Introduction: https://imsun.net/posts/gitment-introduction/
gitment:
enable: true
mint: true
count: true
lazy: false
cleanly: true
language: zh-Hans
github_user: # github name
github_repo: # 博客域名
client_id: # 注册 OAuth Application 得到的 client_id
client_secret: # 注册 OAuth Application 得到的 client_secret
畅言评论
- 注册登录畅言评论官网
设置网站信息

获取 APP ID 和APP KEY

修改主题配置文件 _config.yml

重新发布
