安装前提

安装 Hexo 需要先安装下列应用程序:

  1. Node.js (Node.js 版本需不低于 10.13,建议使用 Node.js 12.0 及以上版本)
  2. Git

安装 hexo cli

1
npm install hexo-cli -g

初始化博客项目

  1. 创建 hexo 博客项目文件夹: hujiyi.github.io

  2. 进入文件后, 打开 Git Bash 命令行窗口

  3. 输入命令执行初始化:hexo init

1
$ hexo init

程序初始化过程如下所示:

1
2
3
4
5
6
7
8
9
10
11
$ hexo init
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO Install dependencies
warning hexo-renderer-stylus > stylus > css-parse > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecat
ed
warning hexo-renderer-stylus > stylus > css-parse > css > source-map-resolve > urix@0.1.0: Please see https://github.com
/lydell/urix#deprecated
warning hexo-renderer-stylus > stylus > css-parse > css > source-map-resolve > resolve-url@0.2.1: https://github.com/lyd
ell/resolve-url#deprecated
warning Your current version of Yarn is out of date. The latest version is "1.22.15", while you're on "1.22.5".
INFO Start blogging with Hexo!
  1. 还原所有的包
1
2
3
4
5
6
7
8
9
10
$ yarn
yarn install v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

Done in 1.39s.

运行测试 Hexo 博客

  1. 生成博客文件
1
hexo g

生成静态文件过程如以下所示:

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
$ hexo g
INFO Validating config
INFO Start processing
INFO Files loaded in 212 ms
(node:1616) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1616) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:1616) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:1616) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:1616) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:1616) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
INFO Generated: archives/index.html
INFO Generated: archives/2021/index.html
INFO Generated: index.html
INFO Generated: archives/2021/11/index.html
INFO Generated: fancybox/jquery.fancybox.min.css
INFO Generated: js/script.js
INFO Generated: css/fonts/FontAwesome.otf
INFO Generated: css/style.css
INFO Generated: fancybox/jquery.fancybox.min.js
INFO Generated: js/jquery-3.4.1.min.js
INFO Generated: css/fonts/fontawesome-webfont.eot
INFO Generated: css/images/banner.jpg
INFO Generated: css/fonts/fontawesome-webfont.woff
INFO Generated: css/fonts/fontawesome-webfont.ttf
INFO Generated: 2021/11/16/hello-world/index.html
INFO Generated: css/fonts/fontawesome-webfont.woff2
INFO Generated: css/fonts/fontawesome-webfont.svg
INFO 17 files generated in 584 ms
  1. 启动本地的测试服务器
1
hexo s

过程如以下所示:

1
2
3
4
$ hexo s
INFO Validating config
INFO Start processing
INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

根据提示,在浏览器中打开网址:http://localhost:4000 , 即可看到博客的运行效果:

配置博客

  1. 修改项目根目录的 _config.yml , 配置博客的标题、作者等相关信息:
1
2
3
4
5
6
7
8
9
10
11
12
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: Laohoo
subtitle: '有时间,就多写点Bug,这样大家才有工作。'
description: '如果你交给某人一个程序,你将折磨他一整天;如果你教某人如何编写程序,你将折磨他一辈子。. ——David Leinweber.'
keywords:
author: Laohoo
language: zh-CN
timezone: ''
  1. 修改项目根目录的 _config.yml , 配置github pages 仓库地址:
1
2
3
4
5
6
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: git@github.com:hujiyi/hujiyi.github.io.git
branch: master
  1. 新建博客文章时使用资源文件夹

使用文章资源文件夹(例如存放图片), 编辑 _config.yml

1
post_asset_folder: true   改为true  

配置 git 用于部署 hexo 博客到 github pages 仓库

特别说明:因为这台电脑 Git 配置了同时使用 giteegithub, 不使用全局配置, 需要对每个项目进行本地 git 配置。 和使用了 Git全局配置 操作略有不同。

  1. 初始化 git 仓库
    在根目录下执行命令:git init
1
2
$ git init
Initialized empty Git repository in D:/sources/hexo-repos/hujiyi.github.io/.git/
  1. 创建增加本地配置
1
2
git config --local user.name '你自己的github用户名'
git config --local user.email '你自己的github邮箱'
  1. git 非全局配置时的增加配置

编辑项目中的文件: .deploy_git/.git/config, 在文件中添加以下内容:

1
2
3
[user]
name = username
email = email
  1. 安装 hexo-deployer-git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ yarn add hexo-deployer-git
yarn add v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ hexo-deployer-git@3.0.0
info All dependencies
└─ hexo-deployer-git@3.0.0
Done in 1.87s.
  1. 生成博客静态文件: hexo g
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
$ hexo g
INFO Validating config
INFO Start processing
INFO Files loaded in 212 ms
(node:1616) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1616) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:1616) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:1616) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:1616) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:1616) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
INFO Generated: archives/index.html
INFO Generated: archives/2021/index.html
INFO Generated: index.html
INFO Generated: archives/2021/11/index.html
INFO Generated: fancybox/jquery.fancybox.min.css
INFO Generated: js/script.js
INFO Generated: css/fonts/FontAwesome.otf
INFO Generated: css/style.css
INFO Generated: fancybox/jquery.fancybox.min.js
INFO Generated: js/jquery-3.4.1.min.js
INFO Generated: css/fonts/fontawesome-webfont.eot
INFO Generated: css/images/banner.jpg
INFO Generated: css/fonts/fontawesome-webfont.woff
INFO Generated: css/fonts/fontawesome-webfont.ttf
INFO Generated: 2021/11/16/hello-world/index.html
INFO Generated: css/fonts/fontawesome-webfont.woff2
INFO Generated: css/fonts/fontawesome-webfont.svg
INFO 17 files generated in 584 ms
  1. 上传到 github pages 仓库: hexo d
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
$ hexo d
INFO Validating config
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
INFO Copying files from extend dirs...
warning: LF will be replaced by CRLF in 2021/11/16/hello-world/index.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in archives/2021/11/index.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in archives/2021/index.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in archives/index.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in css/fonts/fontawesome-webfont.svg.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in css/style.css.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in fancybox/jquery.fancybox.min.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in index.html.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in js/jquery-3.4.1.min.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in js/script.js.
The file will have its original line endings in your working directory
[master (root-commit) ffab492] Site updated: 2021-11-16 16:31:26
17 files changed, 5202 insertions(+)
create mode 100644 2021/11/16/hello-world/index.html
create mode 100644 archives/2021/11/index.html
create mode 100644 archives/2021/index.html
create mode 100644 archives/index.html
create mode 100644 css/fonts/FontAwesome.otf
create mode 100644 css/fonts/fontawesome-webfont.eot
create mode 100644 css/fonts/fontawesome-webfont.svg
create mode 100644 css/fonts/fontawesome-webfont.ttf
create mode 100644 css/fonts/fontawesome-webfont.woff
create mode 100644 css/fonts/fontawesome-webfont.woff2
create mode 100644 css/images/banner.jpg
create mode 100644 css/style.css
create mode 100644 fancybox/jquery.fancybox.min.css
create mode 100644 fancybox/jquery.fancybox.min.js
create mode 100644 index.html
create mode 100644 js/jquery-3.4.1.min.js
create mode 100644 js/script.js
Enumerating objects: 31, done.
Counting objects: 100% (31/31), done.
Delta compression using up to 4 threads
Compressing objects: 100% (25/25), done.
Writing objects: 100% (31/31), 881.69 KiB | 2.44 MiB/s, done.
Total 31 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), done.
To github.com:hujiyi/hujiyi.github.io.git
+ bff8ce1...ffab492 HEAD -> master (forced update)
Branch 'master' set up to track remote branch 'master' from 'git@github.com:hujiyi/hujiyi.github.io.git'.
INFO Deploy done: git
  1. 在相应的 github 仓库中启用 pages 服务后,通过浏览器查看博客运行结果(此项目网址:https://hujiyi.github.io/)

使用 Butterfly 主题

安装 Butterfly 主题

在项目根目录下执行命令:

1
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly

命令执行如以下过程:

1
2
3
4
5
6
7
8
$ git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
Cloning into 'themes/butterfly'...
remote: Enumerating objects: 4685, done.
remote: Counting objects: 100% (719/719), done.
remote: Compressing objects: 100% (409/409), done.
remote: Total 4685 (delta 389), reused 551 (delta 308), pack-reused 3966
Receiving objects: 100% (4685/4685), 2.34 MiB | 5.16 MiB/s, done.
Resolving deltas: 100% (3028/3028), done.

切换为 Butterfly 主题

编辑项目根目录的文件: _config.yml

1
2
3
4
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: butterfly # 在这里更改主题名称

安装 Butterfly 主题需要的插件

在项目根目录下执行命令:

1
yarn add hexo-renderer-pug hexo-renderer-stylus

命令执行如以下过程:

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$ yarn add hexo-renderer-pug hexo-renderer-stylus
yarn add v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
success Saved 30 new dependencies.
info Direct dependencies
├─ hexo-renderer-pug@2.0.0
└─ hexo-renderer-stylus@2.0.1
info All dependencies
├─ @babel/helper-validator-identifier@7.15.7
├─ @babel/parser@7.16.3
├─ assert-never@1.2.1
├─ babel-walk@3.0.0-canary-5
├─ call-bind@1.0.2
├─ character-parser@2.2.0
├─ doctypes@1.1.0
├─ get-intrinsic@1.1.1
├─ has-symbols@1.0.2
├─ has-tostringtag@1.0.0
├─ hexo-renderer-pug@2.0.0
├─ hexo-renderer-stylus@2.0.1
├─ is-expression@4.0.0
├─ is-promise@2.2.2
├─ is-regex@1.1.4
├─ jstransformer@1.0.0
├─ promise@7.3.1
├─ pug-attrs@3.0.0
├─ pug-code-gen@3.0.2
├─ pug-filters@4.0.0
├─ pug-lexer@5.0.1
├─ pug-linker@4.0.0
├─ pug-load@3.0.0
├─ pug-parser@6.0.0
├─ pug-strip-comments@2.0.0
├─ pug@3.0.2
├─ to-fast-properties@2.0.0
├─ token-stream@1.0.0
├─ void-elements@3.1.0
└─ with@7.0.2
Done in 2.48s.

重新生成博客

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ hexo g
INFO Validating config
INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

3.8.4
===================================================================
INFO Start processing
INFO Files loaded in 3.37 s
INFO Generated: 2021/11/16/hello-world/index.html
INFO Generated: archives/2021/11/index.html
INFO Generated: archives/2021/index.html
INFO Generated: archives/index.html
INFO Generated: index.html
INFO 5 files generated in 127 ms

测试运行:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ hexo s
INFO Validating config
INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

3.8.4
===================================================================
INFO Start processing
INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.

在浏览器中打开网址: http://localhost:4000 , 运行效果如下图所示:

添加博客的 page

  1. 新建标签 tags 页面
1

  1. 新建标签 tags 页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ hexo new page "tags"
INFO Validating config
INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

3.8.4
===================================================================
INFO Created: D:\sources\hexo-repos\hujiyi.github.io\source\tags\index.md

编辑文件: source/tags/index.md , 修改内容如以下所示:

1
2
3
4
5
6
---
title: tags
date: 2021-11-16 16:00:00
type: "tags"
layout: "tags"
---
  1. 新建分类 categories 页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ hexo new page "categories"
INFO Validating config
INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

3.8.4
===================================================================
INFO Created: D:\sources\hexo-repos\hujiyi.github.io\source\categories\index.md

编辑文件: source/categories/index.md , 修改内容如以下所示:

1
2
3
4
5
6
7
---
title: categories
date: 2021-11-16 16:00:00
type: "categories"
layout: "categories"
---

  1. 新建关于 about 页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ hexo new page "about"
INFO Validating config
INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

3.8.4
===================================================================
INFO Created: D:\sources\hexo-repos\hujiyi.github.io\source\about\index.md

编辑文件: source/about/index.md , 修改内容如以下所示:

1
2
3
4
5
6
7
8
---
title: about
date: 2021-11-16 16:00:00
type: "about"
layout: "about"
---

这里什么都没有留下
  1. 新建友情链接 link 页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ hexo new page link
INFO Validating config
INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

3.8.4
===================================================================
INFO Created: D:\sources\hexo-repos\hujiyi.github.io\source\link\index.md

编辑文件: source/link/index.md , 修改内容如以下所示:

1
2
3
4
5
6
---
title: link
date: 2021-11-16 16:00:00
type: "link"
layout: "link"
---

Hexo博客目录 中的 source/_data(如果没有 _data 文件夹,请自行创建),创建一个文件 link.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
- class_name: 友情链接
class_desc: 那些人,那些事
link_list:
- name: Hexo
link: https://hexo.io/zh-tw/
avatar: https://d33wubrfki0l68.cloudfront.net/6657ba50e702d84afb32fe846bed54fba1a77add/827ae/logo.svg
descr: 快速、简单且强大的网誌框架

- class_name: 网站
class_desc: 值得推荐的网站
link_list:
- name: Laohoo @gitee.io
link: https://hujiyi.gitee.io/
avatar: https://i.loli.net/2020/05/14/9ZkGg8v3azHJfM1.png
descr: 博客网站
- name: Weibo
link: https://www.weibo.com/
avatar: https://i.loli.net/2020/05/14/TLJBum386vcnI1P.png
descr: 中国最大社交分享平台
- name: Twitter
link: https://twitter.com/
avatar: https://i.loli.net/2020/05/14/5VyHPQqR6LWF39a.png
descr: 社交分享平台

class_name和class_desc支持html格式书写,如不需要,也可以留空。

  1. 新建音乐 music 页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ hexo new page music
INFO Validating config
INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

3.8.4
===================================================================
INFO Created: D:\sources\hexo-repos\hujiyi.github.io\source\music\index.md

编辑文件: source/music/index.md , 修改内容如以下所示:

1
2
3
4
5
6
7
---
title: music
date: 2021-11-16 16:00:00
type: "music"
layout: "music"
---
这里什么都没有留下
  1. 新建电影 movies 页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ hexo new page movies
INFO Validating config
INFO
===================================================================

##### # # ##### ##### ###### ##### ###### # # #
# # # # # # # # # # # # #
##### # # # # ##### # # ##### # #
# # # # # # # ##### # # #
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #

3.8.4
===================================================================
INFO Created: D:\sources\hexo-repos\hujiyi.github.io\source\movies\index.md

编辑文件: source/movies/index.md , 修改内容如以下所示:

1
2
3
4
5
6
7
---
title: movies
date: 2021-11-16 16:00:00
type: "movies"
layout: "movies"
---
这里什么都没有留下

配置主题

hexo博客 的根目录创建一个文件 _config.butterfly.yml,并把主题目录的 themes/butterfly/_config.yml 内容复制到 _config.butterfly.yml

编辑 _config.butterfly.yml,启用导航主菜单:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# format: name: link || icon
# sub-menu
# name || icon:
# name: link || icon

menu:
Home: / || fas fa-home
Archives: /archives/ || fas fa-archive
Tags: /tags/ || fas fa-tags
Categories: /categories/ || fas fa-folder-open
List||fas fa-list:
Music: /music/ || fas fa-music
Movie: /movies/ || fas fa-video
Link: /link/ || fas fa-link
About: /about/ || fas fa-heart

注意: 不要把主题目录的 _config.yml 删掉

注意: 以后只需要在 _config.butterfly.yml进行配置就行。如果使用了 _config.butterfly.yml, 配置主题的 themes/butterfly/_config.yml 将不会有效果。

Hexo会自动合并主题中的themes/butterfly/_config.yml 和 _config.butterfly.yml 里的配置,如果存在同名配置,会使用_config.butterfly.yml 的配置,其优先度较高

  1. 安装搜索插件:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ yarn add hexo-generator-search
yarn add v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ hexo-generator-search@2.4.3
info All dependencies
└─ hexo-generator-search@2.4.3
Done in 2.66s.
  1. 编辑 _config.butterfly.yml
1
2
3
# Local search
local_search:
enable: true # 改为 true

字数统计

  1. 安装插件:
1
yarn add hexo-wordcount
  1. 编辑 _config.butterfly.yml
1
2
3
4
5
6
# wordcount (字數統計)
wordcount:
enable: true # 改为 true
post_wordcount: true
min2read: true
total_wordcount: true

使用 Gitalk 评论系统

创建 OAuth Application

Gitalk 需要一个 Github Application,打开 https://github.com/settings/applications/new 当然,也可以在用户头像下的 setting 下的 Developer settings 中 new 一个 Application,然后填写相应的参数。

Register a new OAuth application

Application name (名字随便填,例如:Hujy blog comments)

Something users will recognize and trust.

Homepage URL (博客地址:https://hujiyi.github.io/)

The full URL to your application homepage.

Application description (描述,随便填)

This is displayed to all users of your application.

Authorization callback URL (博客地址,回调地址:https://hujiyi.github.io/)

Your application’s callback URL. Read our OAuth documentation for more information.

完成后会生成相应的 clientIDclientSecret

启用 Gitalk 评论系统

打开 _config.butterfly.yml , 找到 # Comments System, 修改如以下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Comments System
# --------------------------------------

comments:
# Up to two comments system, the first will be shown as default
# Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo
use:
- Gitalk
# - Valine
# - Disqus
text: true # Display the comment name next to the button
# lazyload: The comment system will be load when comment element enters the browser's viewport.
# If you set it to true, the comment count will be invalid
lazyload: true
count: true # Display comment count in post's top_img
card_post_count: true # Display comment count in Home Page

继续在 _config.butterfly.yml中 , 找到 # gitalk, 修改如以下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# gitalk
# https://github.com/gitalk/gitalk
gitalk:
client_id: 66************** #必须. GitHub Application Client ID.
client_secret: abac*************************************** #必须. GitHub Application Client Secret.
repo: blogcomments #必须. GitHub repository.
owner: hujiyi #必须. GitHub repository 所有者,可以是个人或者组织。
admin: hujiyi #必须. GitHub repository 的所有者和合作者 (对这个 repository 有写权限的用户)。
language: zh-CN # en, zh-CN, zh-TW, es-ES, fr, ru
perPage: 10 # Pagination size, with maximum 100.
distractionFreeMode: false # Facebook-like distraction free mode.
pagerDirection: last # Comment sorting direction, available values are last and first.
createIssueManually: false # Gitalk will create a corresponding github issue for your every single page automatically
option:

以上内容中的 client_idclient_secret 的值已用 * 进行隐藏;

===END===