# Multilingual Subdirectory Layouts

**URL:** <https://discourse.gohugo.io/t/multilingual-subdirectory-layouts/31390>\
**Category:** support\
**Created:** [February 23, 2021, 8:28am UTC](https://discourse.gohugo.io/t/multilingual-subdirectory-layouts/31390 "2021-02-23T08:28:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Lassak](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/daniel_lassak/32/9897_2.png) [@Daniel\_Lassak](https://discourse.gohugo.io/u/Daniel_Lassak)\
**Post date:** [February 23, 2021, 8:28am UTC](https://discourse.gohugo.io/t/multilingual-subdirectory-layouts/31390/1 "2021-02-23T08:28:59Z")

</div>

Hello,  
in my content/ folder i have files in my various subfolders/categories that look like this:  
– accessories  
— cat\_1  
---- article\_1  
----- index.en.md  
----- index.en.md  
---- article\_2  
----- index.en.md  
----- index.en.md  
— cat\_2  
---- article\_1  
----- index.en.md  
----- index.en.md

and my folder structure (public/) should later look like this:  
– zubehoer  
— kategorie\_1  
---- artikel\_1  
----- index.html  
---- artikel\_2  
----- index.html  
— kategorie\_2  
---- artikel\_1  
----- index.html  
– en  
— category\_1  
---- article\_1  
----- index.html  
etc…

Is this possible? How can i achive this?

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 23, 2021, 11:25am UTC](https://discourse.gohugo.io/t/multilingual-subdirectory-layouts/31390/2 "2021-02-23T11:25:39Z")

</div>

No. That’s not possible. What is possible is the following:

```auto
de
|-kategorien
  |-subkategorie1
  |-...
en
|-categories
  |-subcategory1
  |-...

```

Then you set your default content language (german) and set that it is NOT in a subfolder in the resulting site:

```auto
defaultContentLanguage: de
defaultContentLanguageInSubdir: false

```

Note: I assume your german language is called de. If you call it deutsch you need to set that title there.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 23, 2021, 2:57pm UTC](https://discourse.gohugo.io/t/multilingual-subdirectory-layouts/31390/3 "2021-02-23T14:57:12Z")

</div>

By the way @Daniel_Lassak: I just realised that you might run into troubles this way in regards to “connecting” your content languages. With your old way, the filename-path-thingy makes it clear to Hugo, that your English about file (about.en.md) is connected to the German one (about.de.md). To have it working in this new by-language-directory-version you need to look after some things:

- name `content/de/about.md` and `content/en/about.md` identical, don’t change the filename by language. same location and same name for every connected item
- add a slug parameter to your frontmatter if you wish to have a different URL (`slug: ueber-uns` in the german version for the `content/de/about.md` file)

There is a way to add a frontmatter parameter that links these files, but I couldn’t find the name of the parameter this fast. You probably want to give the following link a thorough read (again):

> **[Multilingual Mode](https://gohugo.io/content-management/multilingual/)**
>
> Hugo supports the creation of websites with multiple languages side by side.

---

<div class="post-metadata">

**Author:** ![Daniel\_Lassak](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/daniel_lassak/32/9897_2.png) [@Daniel\_Lassak](https://discourse.gohugo.io/u/Daniel_Lassak)\
**Post date:** [February 24, 2021, 6:50am UTC](https://discourse.gohugo.io/t/multilingual-subdirectory-layouts/31390/4 "2021-02-24T06:50:55Z")

</div>

I ended now in this config.

```
defaultContentLanguage = "de"
defaultContentLanguageInSubdir = true
relativeURLs = true
[languages] 
  [languages.de]
    weight = 1
    languageName = "Deutsch"
    contentDir = "content/de"
    languageNameShort = "de"
    languageCode = "de_DE"
  [languages.en]
    weight = 2
    languageName = "English"
    contentDir = "content/en"
    languageNameShort = "en"
    languageCode = "en_US"

```

and that worked for me.  
if i set

`defaultContentLanguageInSubdir = false`

i dont get a redirect to /de from my root-folder.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 24, 2021, 8:07am UTC](https://discourse.gohugo.io/t/multilingual-subdirectory-layouts/31390/5 "2021-02-24T08:07:06Z")

</div>

I never had a setup where I would put the default language into a subdirectory. If you are hosting on Netlify or another service that offers redirection and headers this could be solved by some language headers:

> **[Redirects and rewrites](https://docs.netlify.com/routing/redirects/)**
>
> Netlify builds, deploys, and hosts your front end.
> Learn how to get started, see examples, and view documentation for the modern web platform.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [February 26, 2021, 8:07am UTC](https://discourse.gohugo.io/t/multilingual-subdirectory-layouts/31390/6 "2021-02-26T08:07:47Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
