Internationalisation - menus and url

Hi

I’m trying to to translate my content to a second language
I’m using one directory per language - site can be found here

I want to keep the directories identical for both (in english) - and do the translation in of the url in the _index.md files. Slug doesn’t seem to work on list pages (according to this post- and when starting to use the full url it seems that it needs to be done on all the files below which seems to be risky in terms of typing errors (I tried using url on the list pages and slug on articles - but the article at the lowest level still doesn’t seem to inherit the urls of the categories above and uses the non-translated directory structure)

I’m also not certain how I should define the menu in the front matter - should I need to add the language code to the menu in the front matter? I tried to translate one item - the issue is that now both the translated version and the ‘original’ version appear in the navigation.

My questions:

  1. Is it possible to keep the directory structure in English for the translated version without having to add the full url to the front matter for all pages. Or is it better to translate the directory structure and use a translation key to connect them together.
  2. How do I define the menu in front matter for the translated version to avoid duplicates (both translated and original content appearing in the navigation;

Thanks for your help.

You should maybe have a look at this site, which solves (if I understand your use case correctly):

1 Like

Thanks for replying. It’s not really a solution for my case as I also need the folders and subfolders translated, and slug isn’t working in that case.

The simplest solution seemed to translate all the folders and subfolders and to set the translationkey on all levels (on the articles and list pages). This seems to work.

Hi, to achieve that, all folders in /content need to be translated. As that also impacts PageSections you need _index.md in each folder with

cascade:
    type: "englishFolderName"

Each page filename furthermore is translated itself and needs

translationKey: "englishPageName"

The menu definition I do keep in the Site’s config following the standard docs.

Please refrain form overwriting url. This breaks things in multilanguage sites. However, defining slug is okay in the pages.

content --> en --> Peripherals --> Mouse.md
content --> nl-NL --> Randapparatuur --> Muis.md

1 Like