See https://discourse.gohugo.io/t/cascade-yaml-in-configuration-directory/51757
my-project/
└── config/
├── _default/
│ ├── hugo.toml
│ ├── menus.en.toml
│ ├── menus.de.toml
│ └── params.toml
└── production/
└── params.toml
The above is taken from documentation, but currently the base name of every config file below config/ are either:
hugo or config (a full config file)
- of a root map key in the config.
While almost all of our config entries that holds something other than a scalar value are maps, we have some slices, e.g:
- cascade
- permalinks (the recently reworked setup; it used to be a map)
TOML and YAML does not support "headless" arrays (JSON does), so need to figure a way around that.
There are some non-obvious decisions to make here:
We could say e.g. cascade[0].yaml, but that sounds complicated and error prone.
I suggest that we instead invent some kind of pseudo slice container, so the name of the file would be cascade.toml, but the content is something ala:
[[cascade]]
[cascade.params]
color = 'red'
[cascade.target]
kind = 'page'
lang = '{en,de}'
path = '/books/**'
[[cascade]]
[cascade.params]
color = 'blue'
[cascade.target]
environment = 'production'
kind = 'page'
path = '/films/**'
The above means that for slices, the user needs to repeat the base name in the file itself, which I think should be fairly easy to reason about.
See https://discourse.gohugo.io/t/cascade-yaml-in-configuration-directory/51757
my-project/ └── config/ ├── _default/ │ ├── hugo.toml │ ├── menus.en.toml │ ├── menus.de.toml │ └── params.toml └── production/ └── params.tomlThe above is taken from documentation, but currently the base name of every config file below
config/are either:hugoorconfig(a full config file)While almost all of our config entries that holds something other than a scalar value are maps, we have some slices, e.g:
TOML and YAML does not support "headless" arrays (JSON does), so need to figure a way around that.
There are some non-obvious decisions to make here:
We could say e.g.
cascade[0].yaml, but that sounds complicated and error prone.I suggest that we instead invent some kind of pseudo slice container, so the name of the file would be
cascade.toml, but the content is something ala:The above means that for slices, the user needs to repeat the base name in the file itself, which I think should be fairly easy to reason about.