I prefer writing my posts in English, as this probably can reach the most people. However, I am from Germany and know quite a few people who do not speak English very well. So it always felt a bit unfair to publish only in English.

I have tried to find a convenient way for a multi-language blog for a while. But most solutions that I looked at so far had been too complicated for my taste (I do not like Wordpress, so this option was not available to me). That's why I was really happy to learn that the new ghost software makes this task relatively easy.

The only thing I would improve is to put slightly more information in the official ghost multi-language tutorial. While it is quite simple to achieve the task, the code examples in the tutorial require a little more tweaking. So here is what I did step by step:

  1. I went to my ghost admin site, selected the Labs section on the bottom left of the page and downloaded my current routes.yaml configuration file. This file configures how the URLs of a ghost blog are handled and we use it to add a dedicated language tag.

  2. The routes.yaml file is configured to contain a new collection:

        permalink: /{slug}/
        template: index
        filter: 'tag:-de'
        permalink: /de/{slug}/
        template: de
        filter: 'tag:de'
      tag: /tag/{slug}/
      author: /author/{slug}/
  3. It is actually required to modify the theme of the ghost blog as well. I am using the default theme called casper, so I downloaded it through the admin panel in the Design section. Afterwards I unzipped the downloaded file and modified the index.hbs and post.hbs files and created a de.hbs file.

  4. index.hbs got the content <html lang="en"> inserted early in the file:

{{!< default}}
{{!-- The tag above means: insert everything in this file into the {body} of the default.hbs template --}}

<html lang="en">
{{> header background=@site.cover_image}} {{!--Special header.hbs partial to generate the <header> tag--}}

[...rest of the file unchanged...]
  1. de.hbs is a copy of index.hbs, only with <html lang="de"> instead of <html lang="en"> inserted.
  2. The file post.hbs is quite long, but again, the modifications are not very big: I simply inserted the following after the line that says {{#post}}:
[...everything up to here unchanged...]
  {{#has tag="de"}}
    <html lang="de">
  {{ else}}
    <html lang="en">
[...rest of the file unchanged...]
  1. That are all the modifications. The only thing that remains is to zip the modified theme and upload everything back up through the admin panel where it was downloaded before. So the routes.yaml in the Labs section and the theme zip file in the Design section of the panel.

With these modifications, creating posts in English and German is super easy: English posts work as before, and German posts simply receive the tag de. Now they will be available under <server-url>/de/<post-name>.

So this post is available in German here: https://home.matou.de/de/ghost-posts-in-mehreren-sprachen/

And all posts in German can be viewed under https://home.matou.de/de/, while Englisch posts are under https://home.matou.de/.

I do not fully understand what the configurations do exactly, but it got me where I wanted to go and maybe it can help someone else to achieve the same thing.