Win10+Hexo+gitpage搭建博客流程

需要安装的文件

  • Node.js (默认自带了npm)

  • git

  • 进入git bash安装安装hexo npm install hexo-cli -g

Hexo 初始化和本地预览

1
2
3
hexo g # 生成页面

hexo s # 启动预览

访问 http://localhost:4000,出现 Hexo 默认页面,本地博客安装成功!

部署 Hexo 到 GitHub Pages

安装: npm install hexo-deployer-git --save

然后修改 _config.yml 文件末尾的 Deployment 部分,修改成如下:

1
2
3
4
deploy:
type: git
repository: git@github.com:用户名/用户名.github.io.git
branch: master

运行 hexo d 将网站上传部署到 GitHub Pages。

访问 https://用户名.github.io 就可以看到部署的自己网站

更改主题

进入themes文件夹下运行下载

clonelink
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

然后打开_config.yml 配置文件

```theme: landscape ```替换成```theme: hexo-theme-next```

重新在项目根目录下进行本地部署调试 ```hexo s``` 即可看到效果



### 本地做更改后,重新发布到GitHub

```bash

hexo clean # 清除缓存文件等

hexo g # 生成页面

hexo s # 启动预览

连着的命令

1
2
3
4
5
6
7

# 就是清除、生成、启动
hexo clean && hexo g -s


# 就是清除、生成、部署
hexo clean && hexo g -d

Next设置

ref:

http://theme-next.iissnan.com/getting-started.html#select-language

http://theme-next.iissnan.com/theme-settings.html

https://go2think.com/build-blog-with-hexo-on-github-pages/

正常显示Mathjax

ref: https://wangcong.net/article/HexoWihLaTeX.html#comments

设置访问总站pv和uv(不蒜子)

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
busuanzi_count:
# count values only if the other configs are false
enable: true
# custom uv span for the whole site
site_uv: true
site_uv_header: <i class="fa fa-user"></i>
site_uv_footer:
# custom pv span for the whole site
site_pv: true
site_pv_header: <i class="fa fa-eye"></i>
site_pv_footer:
# custom pv span for one page only
page_pv: true
page_pv_header: <i class="fa fa-file-o"></i>
page_pv_footer:
# 或者
busuanzi_count:
# count values only if the other configs are false
enable: true
# custom uv span for the whole site
site_uv: true
site_uv_header: 访客数
site_uv_footer: 人
# custom pv span for the whole site
site_pv: true
site_pv_header: 总访问量
site_pv_footer: 次
# custom pv span for one page only
page_pv: true
page_pv_header: <i class="fa fa-file-o"></i> 阅读数
page_pv_footer:

设置阅读字数和时长

1
2
3
4
5
6
post_wordcount:
item_text: true
wordcount: true # 单篇 字数统计
min2read: true # 单篇 阅读时长
totalcount: false # 网站 字数统计
separated_meta: true