I18N with multiple content folders

Hi all :slight_smile:

I am implementing Netlify CMS on a translated website in Hugo and run into trouble understanding how to configure it to work with the current content structure. My question would be, if it’s possible to implement a translation interface (using collections, not the whole content folder) with the following setup:

Current content structure:

content/en/topic/page/index.md - contains the English version
content/es/topic/page/index.md - contains the Spanish version.

From the docs it does not look to me like I will be able to keep this structure (there are plenty of other folders on the topic and page level of the content structure).

Assuming I have a collection for topic set up as the following the only way I see i18n working would be to add the translations inside of the current English folder:

collections:
  - name: "topic"
    folder: "content/en/topic"
    i18n: true

I have no issue reworking the content structure, just trying to find out if I overlooked something up to here.

A nice feature might be a slug for the language identifier like this:

slug: "{{lang}}/topic/{{slug}}/index"

which might solve the blockage :wink:

I talked through this in some detail in the past with someone, let me see if I can find the thread.

The TL;DR there is there is no explicit support for it so you will have to “get clever” around making them separate collections if you want them to be segmented at the bottom level by language, which as you mention would require reworking the paths (so that it was more like content/topic/lang).

Perhaps an easier way to approach this would be to have a separate content site per language? Each could have its own config.yml specifying only the collections for its language, and you could proxy them all together using a pattern like this:

(you wouldn’t necessarily have multiple repositories - or you might - but you can still stitch multiple deploys together like that, while leveraging common assets like js/css/graphics for all).

1 Like