I’m trying to follow the Example – conditionally hide section.
$ hugo version
hugo v0.146.5+extended+withdeploy darwin/arm64 BuildDate=2025-04-15T17:54:38Z VendorInfo=brew
An abstract version of my multilingual site:
content
├── _index.de.md
├── _index.en.md
├── _index.sv.md
├── internal
│ ├── _index.md
│ └── sections
│ ├── _index.md
│ ├── a.de.md
│ ├── a.en.md
│ ├── a.sv.md
│ ├── b.de.md
│ ├── b.en.md
│ ├── b.sv.md
│ ├── c.de.md
│ ├── c.en.md
│ └── c.sv.md
└── sub
├── _index.de.md
├── _index.en.md
└── _index.sv.md
I want to hide anything under the internal
branch but still be able to include pages from internal/sections
in various templates, for example I’m successfully able to this when building a menu:
{{ range $i, $s := where .Site.RegularPages "Type" "internal" }}
<a href="{{ relLangURL "/" }}#{{ .LinkTitle | anchorize }}">{{ .LinkTitle }}</a>
{{ end }}
I also successfully do this to render all the pages under internal/sections
from another template:
{{ range $i, $s := where .Site.RegularPages "Type" "internal" }}
{{ partial "section.html" (dict "context" . "nr" $i) }}
{{ end }}
To hide the internal
branch, both content/internal/_index.md
and content/internal/sections/_index.md
have the following content:
+++
title = "Internal"
[[cascade]]
[cascade.build]
list = 'never'
render = 'never'
[cascade.target]
environment = 'production'
+++
Despite this, for the default language (sv) the internal
branch gets published.
public/internal
├── index.html
├── index.xml
└── sections
├── a
│ └── index.html
├── index.html
├── index.xml
├── b
│ └── index.html
└── c
└── index.html
Likwise for the de
and en
.
public/de/internal
├── index.html
├── index.xml
└── sections
├── a
│ └── index.html
├── b
│ └── index.html
└── c
└── index.html
, and:
public/en/internal
├── index.html
├── index.xml
└── sections
├── a
│ └── index.html
├── b
│ └── index.html
└── c
└── index.html
What am I doing wrong?