Personal Blog with Hexo

Jay Zhou Lv1

This blog tracks how I setup my personal website using Hexo.

Env Initialization

The official documentation for Hexo is here . To setup Hexo env, node.js is needed. I isolated the dev env using miniconda . git is also required.

1
2
3
4
conda create -n hexo -c conda-forge nodejs -y
conda activate hexo
# as stated in the `Hexo` docs.
npm install -g hexo-cli

Setup

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

Theme Redefine

I appreciate the simplicity of Hexo theme Redefine. ### Installation

  1. Using npm

    1
    2
    cd <folder>
    npm install hexo-theme-redefine@latest

  2. In _config.yml, set

    1
    theme: redefine

  3. Create _config.redefine.yml file in Hexo root directory. Copy everything from here into it.

Mathjax

For LaTex rendering support. Installation guide here .

  1. Using npm
    1
    npm install hexo-filter-mathjax
  2. Install hexo-renderer-pandoc as renderer
    1
    2
    conda install -c conda-forge pandoc
    npm install hexo-renderer-pandoc --save
  3. Append configuration in _config.yml
    1
    2
    3
    4
    5
    6
    7
    mathjax:
    tags: none # or 'ams' or 'all'
    single_dollars: true # enable single dollar signs as in-line math delimiters
    cjk_width: 0.9 # relative CJK char width
    normal_width: 0.6 # relative normal (monospace) width
    append_css: true # add CSS to every page
    every_page: false # if true, every page will be rendered by mathjax regardless the `mathjax` setting in Front-matter of each article
  4. Set mathjax: true in your article
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    ---
    title: MathJax Test
    date: 2020-09-12 16:02:07
    tags: MathJax
    categories: MathJax
    mathjax: true
    ---
    $$
    i\hbar\frac{\partial}{\partial t}\psi=-\frac{\hbar^2}{2m}\nabla^2\psi+V\psi
    $$

Gitalk Comments

Follow the steps here .

  1. Create new OAuth App
    • Homepage URL and Authorization callback URL should all be your github pages url
    • Save Client ID and Client Secret
  2. Create a repo for Gitalk comments
  3. Set _config.redefine.yml config file
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    comment:
    # Whether to enable comment
    enable: true
    # Comment system
    system: gitalk # waline, gitalk, twikoo
    config:
    gitalk:
    clientID: <sample_1234567890abcdef1234>
    clientSecret: <sample_1234567890abcdef1234567890abcdef12345678>
    repo: <created_repo>
    owner: <github_usrname>

Deployment

As documented here .

  1. Using npm
    1
    npm install hexo-deployer-git --save
  2. Update _config.yml
    1
    2
    3
    4
    deploy:
    type: git
    repo: git@github.com:<github_usrname>/<github_usrname>.github.io.git
    branch: main
  • Title: Personal Blog with Hexo
  • Author: Jay Zhou
  • Created at : 2023-06-14 17:04:22
  • Updated at : 2023-06-30 01:07:14
  • Link: https://ja1zhou.github.io/2023/06/14/Personal-Blog-with-Hexo/
  • License: This work is licensed under CC BY-NC-SA 4.0.
 Comments