I did a little improvement on my blog during Dragon Boat Festival. One of the purposes: multilingual support(mainly English / Chinese), requirement：immersive reading。
After reseaching, i found the following tools about Hexo internationalization:
- Hexo official internationalization
- Hexo official recommended plugin: hexo-generator-i18n
- Non-Offical plugin: hexo-multilingual
It’s mainly to meet template multi-language requirement
Add configuration in _config.yml, to generate multi-language folder,
The biggest problem is the blogs belong to different language will mix together, can not read the goal: immersive reading.
Change hexo blog
package.json dependencies from:
to customized generators:
The plugin will consider language information in the generated pages. By adding the configuration files as follows, the plugin will override configuration of different language, such as title, subtitle, etc.
config_xx.yml will override the root configuration file:
theme_xx.yml will override the theme configuration file:
The custumized generators and overrided configuration file can meat part of the immersive reading requirement, except for the following critical bugs:
When i run:
The languages will be seperated well, however, when i run:
public folder and it’s files has following problems:
- Some link is not considering language, this will lead to dead link
- Configuration override failed, screw up
- Other hexo plugins, such as
hexo-generator-sitemap, rely on the single language principle, then they all fail in this circumstance, oh no!
Personally won’t give too much time on this stuff.
My blog is using static files generated by Hexo and Nginx as reverse proxy. I remember here i can take advantage of
alias for the different location:
- Set up multiple (two) independent blogs, each handle the post and theme of one language
- Use Nginx to acchive location dispatch
The final solution:
Config the blogs, the critical part of root
_config will be:
Then you can write your post and decorate your theme as you wish.
Please refer tonginx-offical-docs if you are interested in this rule.
checkout my blog：http://kvh.io/en。
This artical describes a workaround to set up immersive multilingual hexo blog, by setting up multiple Hexo blogs, and using Nginx to dispatch visitting to different alias.
No related post.