KarL05/Aiyiyi's Blog
HEXO Blog Setup

Setting up this Hexo blog is quite difficult. There are many unexpected problems that are solved and I will record them in this entry.

  1. Install Node.js and Git

  2. Install Hexo https://hexo.io/

  3. Install Hexo Theme Journal https://github.com/SumiMakito/hexo-theme-journal/

  4. Install Pandoc for LaTeX https://blog.csdn.net/qq_52466006/article/details/126924064

At this step, many problems occur. The major issue is the theme does not support LaTeX. I tried changing to $npm install hexo-renderer-kramed and $npm install hexo-renderer-mathjax but it doesn't work. The reason is likely because that these two plugins are too old. On the otherhand, $npm install hexo-renderer-pandoc is a safer choice because it needs less modifications and more robust.

From my research, this solution is more likely to work and should work for all themes on Hexo.

Write this in Powershell

1
2
3
$npm un hexo-math
$npm un hexo-renderer-marked
$npm i hexo-renderer-pandoc

  1. Add the following to _config.yml in themes folder.

Here a problem that I encountered is that all $$ symbol in LaTeX is replaced by \[. The solution is to refer to a javascript in your HTML file. I tried http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML but it does not work. This should be because this cdn is already down so a later one should be used instead.

1
2
3
4
mathjax:
enable: true
per_page: true
cdn: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js

Its also worth trying to add this:

1
 

in all MarkDown files that needs LaTeX.

  1. Enter pandoc -v and see if Pandoc is successfully installed.

  2. Build the static website.

There are some general requirements for Hexo MarkDown files, such as no three slashes together, and the MarkDown files should be placed under _posts folder.

I added a profile page for my Blog. To do this, change the _config.yml in the themes folder and change the menu section. The format is <Name>: <Path>, for my Blog its About Me: /About.html.

Write this in Powershell

1
2
$npx hexo generate
$npx hexo server
  1. If successful, deploy the static website on Github Page! https://hexo.io/docs/one-command-deployment

Write this in Powershell

1
$npm install hexo-deployer-git --save

Change the _config.yml in the root folder:

1
2
3
4
5
deploy:
type: git
repo: <repository url> # https://bitbucket.org/JohnSmith/johnsmith.bitbucket.io
branch: gh-pages
message: [message]

And try

Here my connections was very unstable. The solution is to do git config --global --unset http.proxy then do git config --global --unset https.proxy

1
$npx hexo deploy

And my Hexo blog is successfully initialised on Github Page!