Hexo: multi-lang site building

Created on 11 Sep 2014  路  6Comments  路  Source: hexojs/hexo

hexo 2.8 includes the multi-language support and I find it useful to separate my posts. But it doesn't meet my needs to build a multi-lang site because the --lang argument covers no page.
I want to set up a site in this order

/
 |-en/
 |       |-blog/
 |       |        |-post1.md
 |       |        |-post2.md
 |       |        |-...
 |       |docs/
 |       |        |-install.html
 |       |        |-conf.html
 |       |        |-...
 |       |about/
 |       |        |-index.html
 |-zh/
 |       |-blog/
 |       |        |-thread1.md
 |       |        |-thread2.md
 |       |        |-...
 |       |-wiki/
 |       |        |-setup.html
 |       |        |-calibrate.html
 |       |        |-...
 |       |about/
 |       |        |-index.html

Can I achieve this with the latest hexo? I tried but it didn't work:

$ hexo n page "about" --lang en
[info] File created at ~/site/source/about/index.md

Thanks!

discussion feature-request

Most helpful comment

Good idea. Perhaps we could utilize new_post_name like this:

new_post_name: :lang/:title.md

to create a post in _post/en/title.md and

new_post_name: /:lang/blog/:title.md

with a starting / to put them from the root of /source e.g. /source/en/blog/title.md.

This comes in my mind when I played around with a thought, that post's are no longer required to live under _post. Of course we have to specify what type of file we are parsing... e.g. with a type parameter in frontend yml. But this could also be helpfull for creating taxonomies requestet in #828 .

We could than build structures like

/source
  /en
    /blog
    /projects
    /about
    /portfolio

All 6 comments

One bypass I can think of is that I initiate two separate hexo folders /en and /zh and set the root as /en and /zh in two _config.yml, respectively. This is a walk-around while I'll appreciate it if there's a one-stop solution.

Hi, I'm just working on a full Hexo multi-lang site example at hexo-multilanguage-example and all needed features.

Perhaps you want to join and we can concentrate development at one point.

Do I understand you right, if I summaries it to: you request two additional features:

1) splitting the blog into different folders (perhaps my working solution _post/en) fullfills your needs?
2) better hexo cli path generation?

Maybe we need a new setting like new_page_path to customize where new page files will be placed.

Good idea. Perhaps we could utilize new_post_name like this:

new_post_name: :lang/:title.md

to create a post in _post/en/title.md and

new_post_name: /:lang/blog/:title.md

with a starting / to put them from the root of /source e.g. /source/en/blog/title.md.

This comes in my mind when I played around with a thought, that post's are no longer required to live under _post. Of course we have to specify what type of file we are parsing... e.g. with a type parameter in frontend yml. But this could also be helpfull for creating taxonomies requestet in #828 .

We could than build structures like

/source
  /en
    /blog
    /projects
    /about
    /portfolio

Hey guys what's the status on multi-lingual pages? Tried hexo new page 'Page Name' --lang en today and didn't work

Closed for added.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

201507 picture 201507  路  32Comments

pod4g picture pod4g  路  24Comments

fishercoder1534 picture fishercoder1534  路  26Comments

wych42 picture wych42  路  23Comments

dsaltares picture dsaltares  路  46Comments