Search code examples
multilingualslugghost-blog

Multi-lingual Ghost with same slug


I'd like to create a multi-lingual Ghost CMS website, using the same slugs across multi-lingual posts.

e.g.

  • EN: my-site.com/hello-world
  • FR: my-site.com/fr/hello-world

I understand from this walkthrough that I need to create the same post multiple times for each language and the slug must be unique. In order to keep things consistent, I'd like to use the same slug (i.e. hello-world) for the same post across each language. Is there a way to do this, perhaps with dynamic routing?


Solution

  • Just thought I'd let you know that we've updated the tutorial you linked to on using different languages in Ghost: https://ghost.org/tutorials/multi-language-content/

    You can use matching slugs (I assume you're doing this so you can easily switch languages with a button?) but I wouldn't recommend it as the slug might be used as part of your SEO. A slug written in english isn't going to work as well if someone is searching in french.

    The tutorial shows how to create multi-language content and to use <link> elements to add the alternative translations to the meta data. I've created a CodePen demo here on how to create a language select in JavaScript which hooks into those elements: https://codepen.io/daviddarnes/pen/QWwzePz

    Hope this helps!