Multilingual site with section in only one language

Hi

I have a multilingual site. (EN/DE) It has the following folder structure.

content/blog/post1/index.md
content/_index.de.md
content/_index.en.md
content/anothersite.de.md
content/anothersite.en.md
i18n/de.yaml
i18n/en.yaml

Inside my config I have the following language related settings:

defaultContentLanguage: en
defaultContentLanguageInSubdir: true
disableDefaultLanguageRedirect: false
languages:
  en:
    languageCode: en-US
    languageName: EN
    weight: 1
    params:
      xxx
  de:
    languageCode: de-DE
    languageName: DE
    weight: 2
    params:
      xxx
    hideUntranslated: false

Since the blog is only EN, it does not show up on DE pages. {{ range where site.RegularPages "Type" "blog" }} for example returns 0 elements on a DE page.

Is there a way to configure Hugo to “accept” a section in both languages? (or a sort of override function)

Thanks

have a look on

In Hugo 0.148.0 (I’m guessing it will be out in a week or 2) we will:

The above should solve your challenges (and be much more powerful/flexible than lang.Merge).

1 Like

Thank you both for the answer. I solved it with:

{{ $pages := where $.Site.RegularPages "Type" "blog" }}
{{ $pages = $pages | lang.Merge (where .Sites.Default.RegularPages "Type" "blog") }}
{{ range $pages }}
...

@bep I do not fully understand the new features you have linked. I might check it out once it is stable and in the docs.