部署Hexo

1.2k 词

Hexo部署

Content

Installation

1
2
3
4
# Installation
npm install -g hexo-cli
# Check
hexo -v

Initialize Project

1
2
3
4
# Init
hexo init phd_blog
cd phd_blog
npm install

Change Theme

个人很prefer vivia这个theme,直戳XP。

  1. 下载repo
1
2
3
cd /phd_blogs
git clone https://github.com/saicaca/hexo-theme-vivia.git themes/vivia
npm install colorjs.io stylus hexo-symbols-count-time
  1. 创建config文件

vivia目录下的example_config.vivia.ymlcopy一份到/phd_blogs,重命名为_config.vivia.yml

  1. 自定义config
  2. 设置vivia为Theme
1
hexo config theme vivia
  1. 创建aboutPage
1
hexo new page about
  1. Disable the Pagination of Archive Page

Without this configuration, the archive page will only show up to ten articles at most.

1
2
archive_generator:
per_page: 0

One Command Deployment

首先安装hexo-deployer-git

1
2
cd phd_log
npm install hexo-deployer-git --save

Add following info in _config.yml.

1
2
3
4
deploy:
type: git
repo: https://github.com/Antidington/Antidington.github.io
branch: gh-pages

更改repo默认branchgh-pages

Change default branch
一键部署

1
hexo clean && hexo deploy

Reference

  1. https://github.com/saicaca/hexo-theme-vivia#6-disable-the-pagination-of-archive-page
  2. https://hexo.io/zh-cn/docs/github-pages.html
  3. https://hexo.io/zh-cn/docs/one-command-deployment
  4. https://blog.csdn.net/yaorongke/article/details/119089190