跳转至

Hexo

导言

Try hexo blog builder for hexo-icarus theme

Excellent Video Resource

We're still on the lookout for an exceptional blog or overview paper to complement our understanding of this topic. Stay tuned for updates!

Outstanding Blog or Overview Paper

The key words are "rethink", "perspective"

Introduction

Hexo is a NodeJS-based static site generator known for its popularity and wide range of themes.

Speed Comparison

200篇左右的博文用Hexo 需要10分钟去生成静态网页,而Hugo 只需要10秒。

正是依赖于Hugo 快速生成的特点,调试方便成了Hugo的第二大特点。基本上我在源文件处修改的内容可以实时地显示在网页上,而不用再次敲代码生成再预览,这对于博主来说简直就是一个福音。

如果可以,推荐hugo3

Install

$ npm install hexo

# shaojiemike @ snode6 in ~/github [18:01:22]
$ npx hexo init hugoMinos
FATAL ~/github/hugoMinos not empty, please run `hexo init` on an empty folder and then copy your files into it

So create in another place and move necessary files

$ npx hexo init hugoMinos-bk
$ cd hugoMinos-bk

# vim _config.yml change theme to icarus
cp _config.yml ../hugoMinos
cp _config.icarus.yml ../hugoMinos
cp package.json ../hugoMinos

Github Action for Github Pages

Using eaceiris/actions-gh-pages@v3 deploy ./public directory to the remote gh-pages branch.1

.github/worflows/hexo.yml
# deploy to another branch of current repository
- name: Deploy
  uses: peaceiris/actions-gh-pages@v3
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    publish_dir: ./public
    publish_branch: gh-pages-hexo  # default: gh-pages

But cloudflare pages can not deploy two pages on the same repository. So we need to push the static html to another repository.2

.github/worflows/hexo.yml
- name: Deploy
  uses: peaceiris/actions-gh-pages@v3
  with:
    deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
    external_repository: Kirrito-k423/hexo-icarus-static
    # publish_branch: your-branch  # default: gh-pages
    publish_dir: ./public

ACTIONS_DEPLOY_KEY is created and configured here

参考文献


  1. https://github.com/peaceiris/actions-gh-pages 

  2. Deploy to external repository external_repository 

  3. https://sspai.com/post/59904 

评论