Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

具体安装过程

初始化以及生成网站

1
2
3
4
5
6
$ npm install hexo-cli -g # 这步是安装hexo的命令行
$ hexo init blog
$ cd blog
$ npm install
$ hexo g # 或者hexo generate
$ hexo s # 或者hexo server,可以在http://localhost:4000/ 查看

配置

repo 是Github的项目的链接地址

1
2
3
4
deploy:
type: git
repo: git@github.com:xxx.git
branch: master

部署

1
2
$ npm install hexo-deployer-git --save # 需要安装这个插件
$ hexo d # 即可

安装插件

在_config.yml配置文件中添加插件信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
plugins:
hexo-generator-feed #RSS订阅插件
hexo-generator-sitemap #sitemap插件
然后,安装插件,后面要加上--save,表示依赖项。

RSS订阅插件
hexo-generator-feed:生成rss订阅文件
npm install hexo-generator-feed --save
添加配置信息

# sitemap
sitemap:
path: sitemap.xml
SiteMap插件
hexo-generator-sitemap:生成易于搜索引擎搜素的网站地图
npm install hexo-generator-sitemap --save
添加配置信息:

# feed
atom:
type: atom
path: atom.xml
limit: 20
可以在主题配置文件中添加相关配置,可以在页面上显示。
比如,添加链接信息




links:
Feed: /atom.xml
SiteMap: /sitemap.xml

参考博客

https://www.jianshu.com/p/5973c05d7100