This is a simple tutorial on Hexo, including how to use Hexo and deploy to GitHub pages. This also serves as a quick reference for the author.

## Usages

### Essential terminal commands

The following are essential commands to start and publish an article.

• Create a new post: $hexo new "My New Post" • Run server: $ hexo server or $hexo s • Generate static files: $ hexo generate or $hexo g • Deploy to remote sites: $ hexo deploy

### Use org-mode to write blogs for Hexo

This workflow depends on a function written in init-orgmode.el and a few snippets for org-mode. After exporting markdown files into the _posts folder, the mentioned shortcuts are provided by hexo major mode. You may alternatively use terminal commands to generate and deploy blogs, if this major mode is not installed.

1. Create an article using org-mode, in which, use the snippet hexo-head (trigger key: hexo) to create metadata for Hexo markdown, including “title”, “date”, “tags”, etc.

• You could use hexo-more (key: more) to insert the line <!--more-->.

• You could use the collection of snippets hexo-callout-* (key: callout) to insert Bootstrap callout environments.

2. Once drafting is done, you then call zyue/hexo-ox-gfm to export the .md file into _posts/ under the blog home.

3. Call zyue/hexo to start Hexo major mode. Use shortcuts s r to run the localhost to check the article and s s to stop the localhost. If everything is well documented, use s d to publish your article to the github page.

Note: The minor mode ox-gfm uses the github-favored markdown, which preserves soft line breaks. That implies, every line break in org-mode is preserved in markdown files. You may have to unfill-paragraph to avoid unnecessary line breaks in markdown.

## Installation

This section mainly refers to How to use Hexo and deploy to GitHub Pages, which guides me to build up this blog site. All credits deserved by btfak.

### Set information for your new blog

Edit _config.yml and refer to the doc https://hexo.io/docs/configuration.html.

### Set information to use Git

https://github.com/hexojs/hexo-deployer-git

### Set “watch” before starting your work

“watch” command can monitor your files. https://hexo.io/docs/generating.html

https://hexo.io/docs/deployment.html

After writting the above command, you can see your new blog on GitHub Pages.

### Create a new page file

https://hexo.io/docs/writing.html

Add <!-- more --> in the right place.

## Plugins

https://github.com/hexojs/hexo/wiki/Plugins

List of plugins used:

• hexo-deployer-git
• hexo-generator-feed
• hexo-math

First of all, install the plugin hexo-generator-feed (under your blog root path)

which will generate a subfolder hexo-generator-feed under your HEXO/node_modules/.

Add the following settings in your hexo _config.yml:

and the _config.yml of your theme:

### LaTeX

We use hexo-math to render LaTeX sources. First of all, install the plugin

Then set mathjax in your hexo _config.yml:

and remember to enable it in the _config.yml of your theme, e.g. hexo-theme-next:

Note: if set per_page: true, you have to specify mathjax: true in the font matter of each markdown files.

The following is a test of LaTeX codes: the $\LaTeX$ equation for $u_i(x,t)$: $$\frac{\partial u_i}{\partial t} = \lambda \frac{\partial^2 u_i}{\partial x^2}.$$

### Code highlight

The following is an example of Python codes:

### Support for Chinese

It works out of box. Here should be a sentence in Chinese: 这里应该有一段中文。