0%

HEXO 配置及插件清单

Hexo配置

安装Node.js Git

安装Hexo [配置环境变量]

1
$ npm install -g hexo-cli

建站 [您可以在 _config.yml 中修改大部分的配置]

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

插件

(https://github.com/rozbo/hexo-abbrlink)[https://github.com/rozbo/hexo-abbrlink]

1
2
3
4
5
6
7
8
9
# permalink: :year/:month/:day/:id/
permalink: posts/:abbrlink/
abbrlink:
alg: crc32 #support crc16(default) and crc32
rep: dec #support dec(default) and hex
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks

hexo-generator-searchdb

(https://github.com/next-theme/hexo-generator-searchdb)[https://github.com/next-theme/hexo-generator-searchdb]

1
$ npm install hexo-generator-searchdb # settings at nexT theme

主题

nexT

(https://theme-next.js.org/docs/getting-started/)[https://theme-next.js.org/docs/getting-started/]

1
2
3
$ cd hexo-site
$ npm install hexo-theme-next
$ npm install hexo-theme-next@latest
1
2
3
4
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini

font:
enable: true

size: 0.8

# Dependencies: https://github.com/theme-next/hexo-generator-searchdb
local_search:
enable: true

写作

1
2
$ hexo new [layout] <title> # post page draft
$ hexo new "post title with whitespace"
1
$ hexo g -f 

Hexo 引入了差分机制,如果 public 目录存在,那么 hexo g 只会重新生成改动的文件。使用该参数的效果接近 hexo clean && hexo generate

1
2
$ hexo s
$ hexo publish [layout] <title>

Hexo 的一种特殊布局:draft,这种布局在建立时会被保存到 source/_drafts 文件夹,您可通过 publish 命令将草稿移动到 source/_posts 文件夹,该命令的使用方式与 new 十分类似,您也可在命令中指定 layout 来指定布局。草稿默认不会显示在页面中,您可在执行时加上 –draft 参数,或是把 render_drafts 参数设为 true 来预览草稿。

发布

破虚拟主机,用ftp上传,overwrite all.

参考文献

  1. https://hexo.io/docs/
  2. https://hexo.io/zh-cn/docs/