-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Description
What version of Hugo are you using (hugo version)?
$ hugo version hugo v0.149.0-66240338f1b908ca3b163384c8229943e74eb290+extended darwin/arm64 BuildDate=2025-08-27T15:37:16Z VendorInfo=gohugoio
Does this issue reproduce with the latest release?
Yes
Describe the bug
When setting a Hugo configuration value of type list via an environment variable, the parsing result depends on whether the config file already defines the key as a list. If the key does not exist or is undefined, the environment variable is interpreted as a single string. If the key exists as a list, the environment variable is correctly parsed as a list.
Reproduce
- Clone a test repository (arbitrary example):
git clone https://github.com/jmooring/hugo-testing --single-branch --branch=hugo-forum-topic-55568
cd hugo-testing
- Without defining
ignoreFilesin the config:
HUGO_IGNOREFILES='[foo,bar]' hugo config | grep ignore
HUGO_IGNOREFILES='["foo","bar"]' hugo config | grep ignore
Result:
ignorefiles = ['[foo,bar]']
- Create an empty list in the config:
(echo 'ignoreFiles = []'; cat hugo.toml) > tmp && mv tmp hugo.toml
- Run the same command again:
HUGO_IGNOREFILES='[foo,bar]' hugo config | grep ignore
HUGO_IGNOREFILES='["foo","bar"]' hugo config | grep ignore
Result:
ignorefiles = ['foo', 'bar']
Expected behavior
Environment variables defining list-type config keys should be parsed consistently regardless of whether the key exists in the config file.