Why?
I was priviously using jekyll TeXt theme, but the code block shows too small to watch code. Also, I don’t really understand the coding language jekyll is using, so I decide to switch to a more familier javascript framework, hexo.
What is Hexo?
Hexo is a website generator to generate website based on Markdown file, and it is highly customizable.
Install Hexo
Preriquisite: Git
and node.js
.
Install Hexo CLI
1 | npm install -g hexo-cli |
and, we can execute Hexo commands in this way:
1 | npx hexo <command> |
Install Starter Package & Dependencies
1 | npx hexo init blog |
Server
Run these commands, and you will see a starter website is generated by Hexo.
1 | npx hexo g |
Writing
In sourse/__post
folder, we already have a hello-world.md
post that is from Hexo starter package. Basically, we can imitate that first.
For detail Infomation, visit Hexo Doc front-matter
Example:
1 | --- |
Theme
You can search for theme you like on This Site or Github, but in hexo, I will generally recommand next
. It’s not only because it’s highly customizable, but for its already built nice plugins.
Deploy
Use
1 | npx hexo g |
It will generate html file that you might want to deploy to github in pulic
directory, and you can use Github Pages to handle that.
Auto Deploy with Github Actions
Baically, you might find it annoying to generate html
file everytime you want to make a change. Github can handle that for me.
- Uplaod your whole project to Github.
- add a file to your repository,
.github/workflows/deploy.yml
.github/workflows/deploy.yml
1 | name: Pages |