Hugo new content creates slices with closing bracket on new line

When you create a new content file using Hugo new, it takes empty slice values and places the closing bracket on the next line for TOML. This is new behavior and messes up my automation for one of my sites.

old way:

tags = []

new way:

tags = [
]

Is there a flag / config value I can set to go back to the old way? I dug in the code but I could not pinpoint exactly where this change occurred, possible that it happens in a dependency.

No flag in Hugo. We changed TOML library in Hugo 0.17, mainly due to a licensing issue, so you should ask at https://github.com/pelletier/go-toml

But it is perfectly valid TOML, so I wouldn’t be too optimistic.

Thanks, I will look into the library and maybe see if I can submit a PR. In the meantime, I am holding onto the Hugo .16 binary to create new content.

@bep FYI: I submitted a PR to change the encoding of slices and it was merged into go-toml. https://github.com/pelletier/go-toml/pull/119

1 Like

https://github.com/spf13/hugo/pull/2801