hexo-i18n multi-language tutorial, template fluid

This website is bilingual in Chinese and English using this method

This article only lists precautions and key content.

Note: This is not a nanny-level tutorial. If you have any questions, please contact me by email.

the whole idea

  1. Make two identical websites, one in Chinese and one in English. The content of the English website is in Chinese, just use Google Translate.
  2. Hang the English site under the Chinese site. In this case, you need to modify the root of the English site.
  3. Modify the navigation of the two stations so that they can jump to each other
  4. Some navigation configurations for the two stations (modified separately)

Install hexo and fluid

To install hexo, please refer to the official website: https://hexo.io/zh-cn/

To install the fluid theme, please refer to the official website: https://hexo.fluid-dev.com/docs/

Copy the installed hexo. The picture below is the part I installed.

Own configuration of two stations,

1
2
3
4
Modify: _config.yml
> Change the language for the English site: en, and change the language for the Chinese site: zh-CN

> Modify root for English site: /en
1
2
Modify the theme configuration navigation bar, that is, add a menu for switching languages, and modify the fluid configuration file _config.yml
Modify the menu part, add a menu, and make the two stations point to each other.

Key points: Place the static resources generated by the English site under the Chinese site, so that you can access the English site from the Chinese site.

Attached script:

1
2
3
4
5
6
7
8
9
cd /d/hexo/sre-ops/blog-cn
hexo clean
hexo g
mkdir public/en
cd /d/hexo/sre-ops/blog-en
hexo clean
hexo g
cd /d/hexo/
cp -r sre-ops/blog-en/public/* sre-ops/blog-cn/public/en/

Upload to the server (need to provision nginx and domain name)

1
2
3
scp -P 2777 -i key.txt -r sre-ops/blog-cn/public/* root@ip:/etc/nginx/html
scp -P 2777 -i key.txt -r sre-ops/blog-en/public/* root@ip:/etc/nginx/html/en


hexo-i18n multi-language tutorial, template fluid
http://www.7-24.tech/en/2024/05/08/hexo-i18n/