Hexo

安装 hexo

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
root@ox [11:49:31 PM] [~] 
-> # npm install hexo-cli -g
/usr/local/node/v14.16.1/bin/hexo -> /usr/local/node/v14.16.1/lib/node_modules/hexo-cli/bin/hexo
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/hexo-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ hexo-cli@4.2.0
added 65 packages from 53 contributors in 71.217s
root@ox [11:52:01 PM] [~]
-> # hexo version
hexo-cli: 4.2.0
os: Linux 3.10.0-1160.el7.x86_64 linux x64
node: 14.16.1
v8: 8.4.371.19-node.18
uv: 1.40.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.16.1
modules: 83
nghttp2: 1.41.0
napi: 7
llhttp: 2.1.3
openssl: 1.1.1k
cldr: 37.0
icu: 67.1
tz: 2020a
unicode: 13.0

初始化 Blog

1
2
3
4
5
6
7
8
9
10
11
[gg@ox]~/Developer% hexo init Blog
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO Install dependencies
added 190 packages from 160 contributors and audited 196 packages in 31.155s

15 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities

INFO Start blogging with Hexo!

配置 GitHub

1
2
3
4
deploy:
type: git
repo: git@github.com:你的用户名/你的仓库名.git #设置仓库为ssh格式
branch: master

hexo 常用命令

hexo init

新建一个网站。如果没有设置 folder ,Hexo 默认在目前的文件夹建立网站。

new

1
$ hexo init [folder]

hexo new

新建一篇文章。如果没有设置 layout 的话,默认使用 _config.yml 中的 default_layout 参数代替。如果标题包含空格的话,请使用引号括起来。

1
$ hexo new [layout] <title>

hexo generate

生成静态文件。

1
$ hexo generate

hexo deploy

部署网站

1
$ hexo deploy

hexo server

启动服务器。默认情况下,访问网址为: http://localhost:4000/

1
$ hexo server

hexo list

列出资料网站。

1
$ hexo list <type>