There are some useful tips to configure hexo, especially for nexT theme.
- Add Your Own Website
- Add Canvas-nest
- Hide Powered by Hexo
- Enable Math Environment
- Dynamically preview the generated website
- Uniform Image Link
- Add Categories to Sidebar
- Click Avatar to Go Back to Homepage
- Convert html to pdf maintaining the hyperlink
- Markdown Learning Material
- Reference
Add Your Own Website
Method 1
Putting those files in ./public
But $ hexo clean
will delete them
Method 2
Adding them to ./themes/themes-name/source
And $ hexo g
can generate them
And you can add the url of this file into the config file of the theme to make it to be displayed.
1 | menu: |
Add Canvas-nest
Installation
Step 1: Go to NexT dir
Change dir to NexT directory. There must be layout
, source
, languages
and other directories:
1 | $ cd themes/next |
Step 2: Get module
Install module to source/lib
directory:
1 | $ git clone https://github.com/theme-next/theme-next-canvas-nest source/lib/canvas-nest |
Step 3: Set it up
Enable module in NexT _config.yml
file:
1 | canvas_nest: |
And, if you wants to use the CDN, then need to set:
1 | vendors: |
Update
1 | $ cd themes/next/source/lib/canvas-nest |
Hide Powered by Hexo
Open themes/next/layout/_partials/footer.swig
, and use <!-- -->
to hide the relative codes.
Enable Math Environment
Successful method
Install
1 | npm un hexo-renderer-marked --save |
you should use the following setting in theme config file. (/themes/next/_config.yml
)
1 | katex: |
Exploring Process
hexo-math
hexo-math is no longer maintained, and it doesn’t work at all.
guide from hexo-theme-next
hexo-theme-next provides a math environment installment guide here.
hexo-renderer-pandoc(mathjax)
hexo-renderer-pandoc can’t generate files with the following error message:
1 | $ hexo clean && hexo g && hexo s |
hexo-renderer-kramed(mathjax)
hexo-renderer-kramed can generate file but it has some bugs for inline formula.
1 | $p_t^i$ is the price for the i-th asset |
The above code can’t be converted to formula, and shown as plain text.
hexo-renderer-markdown-it(katex)
It can’t show right formula by following those instructions in the website. And I don’t know how to fix it. Some issues for example:
- the code of the formula shows following the formula
hexo-renderer-markdown-it-plus(katex)
This one can work with some extra work.
It can’t show right formula by following those instructions in the website too at the beginning. And it sometimes has the same issue as hexo-renderer-markdown-it
So I try to follow the instruction here.
Install
1 | npm un hexo-renderer-marked --save |
Katex plugin is enabled by default. However, this renderer alone does not work out of the box for mathematical formulas to display correctly on your website. Therefore, you do not need to do anything if you do not want to use Katex. Otherwise, if you want to use katex, you must add this css style to your website: https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0/katex.min.css
But it can’t show \frac correctly, with the mid horizontal line missed
And I found the latest version in github.
1 | # modify the url from hexo-renderer-markdown-it-plus |
The above two url works works perfectly and you should set them in the theme config file.
But the following url comes from hexo-theme-next doesn’t work
1 | # If you want to try the latest version of Katex, use one below instead |
Dynamically preview the generated website
1 | $ npm install hexo-browsersync --save |
The website will automatically refresh when you save your modified file.
Uniform Image Link
Problem Description
If you want to link a picture with an asset folder, you need to use the image_name
directly, but this link can not work in editor, which need the link to be asset/image_name
.
solution
1 | npm install hexo-asset-image --save |
Also make sure
1 | post_asset_folder: true |
Then the asset/image_name
can work properly in hexo.
Add Categories to Sidebar
add
1 | <div class="category-all-page"> |
to
1 | themes\next\layout\_custom |
More Hexo API: https://hexo.io/zh-cn/docs/helpers.html#list-categories
Click Avatar to Go Back to Homepage
File Position: ~/blog/themes/next/layout/_macro/sidebar.swig
Edit this file:
1 | + <a href="/"> |
Convert html to pdf maintaining the hyperlink
https://cloudconvert.com/html-to-pdf
Markdown Learning Material
-
mathematics symbols http://www.access2science.com/latex/Binary.html
-
LaTeX handwritten symbol recognition http://detexify.kirelabs.org/classify.html
Reference
- https://uchuhimo.me/2017/04/11/genesis/#more
- bind your own website
- https://uchuhimo.me/2017/04/11/genesis/
- local_search
- comments
- https://leaferx.online/2018/03/17/hexo-auto-open-vscode/
- hexo new automatically calls vs code
- http://achillessatan.github.io/2016/01/28/2016012804/
- google adsense
- https://reuixiy.github.io/technology/computer/computer-aided-art/2017/06/09/hexo-next-optimization.html
- TopX