# Are mounts incompatible with directory-based multilingual sites?

**URL:** <https://discourse.gohugo.io/t/are-mounts-incompatible-with-directory-based-multilingual-sites/48137>\
**Category:** support\
**Tags:** i18n\
**Created:** [February 6, 2024, 6:15am UTC](https://discourse.gohugo.io/t/are-mounts-incompatible-with-directory-based-multilingual-sites/48137 "2024-02-06T06:15:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dogweather](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dogweather/32/18817_2.png) [@dogweather](https://discourse.gohugo.io/u/dogweather)\
**Post date:** [February 6, 2024, 6:15am UTC](https://discourse.gohugo.io/t/are-mounts-incompatible-with-directory-based-multilingual-sites/48137/1 "2024-02-06T06:15:29Z")

</div>

I have the standard directory structure:

```auto
content/
  en/
  es/

```

(With more than two languages.)

Then, in my languages entries I have the standard:

```yaml
languages:
  en:
    contentDir: content/en
    # ...
  es:
    contentDir: content/es
    # ...

```

But now, I want to additionally use the Union fs to overlay more `content`:

```auto
content-private/
  en/
  es/

```

But adding the mounts breaks my templates:

```yaml
module:
  mounts:
  - source: content
    target: content
  - source: content-private
    target: content

```

These seem like orthogonal concerns: here, `contentDir` is a higher level of abstraction than `mounts`. I.e., specifying `mounts` shouldn’t disable the `contentDir` in language configs.

At any rate, is there a way for this to work?

---

<div class="post-metadata">

**Author:** ![dogweather](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dogweather/32/18817_2.png) [@dogweather](https://discourse.gohugo.io/u/dogweather)\
**Post date:** [February 6, 2024, 6:28am UTC](https://discourse.gohugo.io/t/are-mounts-incompatible-with-directory-based-multilingual-sites/48137/2 "2024-02-06T06:28:31Z")

</div>

Hmm — maybe I can arrive at a solution by starting with the output of `hugo config mounts`? I learned about this command here: [Hugo 0.56.3: A couple of Bug Fixes | Hugo Docs](https://hugo-docs.netlify.app/en/news/0.56.3-relnotes/)

```json
$ hugo config mounts
{
   "path": "project",
   # ...
   "mounts": [
      {
         "source": "content/en",
         "target": "content",
         "lang": "en"
      },
      {
         "source": "content/es",
         "target": "content",
         "lang": "es"
      },
      # ...

```

---

<div class="post-metadata">

**Author:** ![dogweather](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dogweather/32/18817_2.png) [@dogweather](https://discourse.gohugo.io/u/dogweather)\
**Post date:** [February 6, 2024, 6:38am UTC](https://discourse.gohugo.io/t/are-mounts-incompatible-with-directory-based-multilingual-sites/48137/3 "2024-02-06T06:38:17Z")

</div>

Update, yep! I created a `mounts` entry that now works with my directory-based multilingual site. It’s very repetitive and verbose. In a perfect world, this could be one or two lines of configuration. But here it is, from my config file:

```yaml
module:
  mounts:
    - source: content/en
      target: content
      lang: en
    - source: content/de
      target: content
      lang: de
    - source: content/es
      target: content
      lang: es
    - source: content/fi
      target: content
      lang: fi
    - source: content/fr
      target: content
      lang: fr
    - source: content/he
      target: content
      lang: he
    - source: content/hi
      target: content
      lang: hi
    - source: content/it
      target: content
      lang: it
    - source: content/ja
      target: content
      lang: ja
    - source: content/ko
      target: content
      lang: ko
    - source: content/nl
      target: content
      lang: nl
    - source: content/no
      target: content
      lang: 'no'
    - source: content/pl
      target: content
      lang: pl
    - source: content/pt
      target: content
      lang: pt
    - source: content/ru
      target: content
      lang: ru
    - source: content/sv
      target: content
      lang: sv
    - source: content/uk
      target: content
      lang: uk
    - source: content/vi
      target: content
      lang: vi
    - source: content/zh
      target: content
      lang: zh
    - source: content-private/en
      target: content
      lang: en
    - source: content-private/de
      target: content
      lang: de
    - source: content-private/es
      target: content
      lang: es
    - source: content-private/fi
      target: content
      lang: fi
    - source: content-private/fr
      target: content
      lang: fr
    - source: content-private/he
      target: content
      lang: he
    - source: content-private/hi
      target: content
      lang: hi
    - source: content-private/it
      target: content
      lang: it
    - source: content-private/ja
      target: content
      lang: ja
    - source: content-private/ko
      target: content
      lang: ko
    - source: content-private/nl
      target: content
      lang: nl
    - source: content-private/no
      target: content
      lang: 'no'
    - source: content-private/pl
      target: content
      lang: pl
    - source: content-private/pt
      target: content
      lang: pt
    - source: content-private/ru
      target: content
      lang: ru
    - source: content-private/sv
      target: content
      lang: sv
    - source: content-private/uk
      target: content
      lang: uk
    - source: content-private/vi
      target: content
      lang: vi
    - source: content-private/zh
      target: content
      lang: zh

```

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [February 6, 2024, 8:38am UTC](https://discourse.gohugo.io/t/are-mounts-incompatible-with-directory-based-multilingual-sites/48137/4 "2024-02-06T08:38:48Z")

</div>

> [@dogweather](#):
>
> These seem like orthogonal concerns: here, `contentDir` is a higher level of abstraction than `mounts`. I.e., specifying `mounts` shouldn’t disable the `contentDir` in language configs.

`contentDir` defined on language work in combination with mounts. The side effect you see is (I guess) is not related to the content mounts.

The thing is (and this should be marked clearly in the documentation):

- When you don’t set up any mounts, Hugo creates a default set (taking any contentDir setting into account)
- When you set up one or more mount, Hugo will not create any default mounts (e.g. layouts), but will still take any contentDir setting into account.

We added mounts as a “new way to configure” general file mounts at some point, and added that logic to preserve backwards compability while allow for a fine greained mount config (some sites only need the `layouts` directory, so it would be wasteful to set up data, assets etc.).
