I’ve been using Ghost for a couple of months now and I wanted to switch my blog into a multi-language one.
I found this tutorial in Ghost’s official page: https://ghost.org/tutorials/multi-language-content/ but I’m not too sure it is up to date.
There are parts like:
2 Create templates for translated collections
This section guides you through creating another index file for the new language and changing the html tag, but in my theme’s files (Casper), the file that specifies the html tag is default.hbs which makes me doubt that the documentation is up to date.
Do you know what’s the best way to make my blog multi-language? Is there any other documentation or another way to do it?
There are loads of problems with the tutorial. If you were to make your own language specific index.hbs as instructed, Ghost would still not consider that to be “Home” and will not use the landing page CSS.
I’m unsure of the exact use case that was addressed by the tutorial. I believe it is necessary to implement a custom navigation.hbs so you will have translated menus in each language. I’m still investigating it, cannot tell you much more.
Like yourself, I thought the tutorial doesn’t solve the problem, so I started playing around. I thought it was all wrong, but it turns out it is quite accurate, but my understanding of ghost was inadequate (I’m a beginner). The problem is that some things were left unsaid, and I misinterpreted it in various ways.
I finally got it to work for two languages. This is what you can do:
You need to do everything, as explained in the tutorial. Ghost will make a new collection for the additional language e.g. /fr/ for French. You set that in routes.yaml as explained in the tutorial. However, this is only the home for the new language, it will not contain the translated posts.
In Admin Console, you create a tag for each navigation menu item. You also create a different translated tag for each French menu item. And you will tag each post with one of these, English tags for the English posts, French tags for the translated posts.
In Admin Console Design you also set your navigation item. Put the French into the Secondary Navigation. The urls will be in the form: http://site.com/tag/menu-item/ .
In site-nav.hbs you can add your language switch e.g.
As instructed in the tutorial, you now create .hbs template variants e.g. index-fr.hbs, site-nav-fr.hbs, site-header-fr.hbs … even default-fr.hbs.
You switch to the French menu in site-nav-fr.hbs with something like:
{{#if@site.navigation}}
{{navigation type=“secondary”}}
{{/if}}
In all of the others, you fix the calls to default, site-nav, site-header etc. to the french variant.
Now, if you have more than 2 languages, you cannot use the alternate navigation in Admin Console, you can bake the menu into the corrresponding translated site-nav files.
I hope this helps, it seems to work for me, but this is my first experience with Ghost. There might be better ways to do it, or I might have forgotten something, Good luck.