How to covert config files from YAML to TOML

Hello,

I am trying to convert a config.yaml file to the TOML format. Looking at the docs, it appears I can do that using this following command:

hugo convert toTOML --config config.yaml --unsafe --verbose

When I run it though, nothing seems to happen. I would expect to see a config.toml be generated. Is this command only meant for converting front matter and not config files or am I just doing it wrong?

Thanks,

Josh

Documentation: https://gohugo.io/commands/hugo_convert_totoml/

@joshuawhite929, as you wait for someone to answer you question as it relates to this:

hugo convert toTOML --config config.yaml --unsafe --verbose

Have you tried this third party online tool?

1 Like

From what I know, yes.

Exactly. It also only works on files in the content directory.

Thanks for the responses. I’ll use the tool @Weru suggested. I’ll open up an issue to get this clarified in the docs. Thanks.

It is quite clear in the docs :wink:

toTOML converts all front matter in the content directory to use TOML for the front matter.

Patrick, I am new to Hugo and was thrown off by the usage of the --config string flag/parameter. I assumed incorrectly that this was used to specify the config file to convert. Can you help me understand how this is used for converting front matter?

The --config parameter is always only used to point Hugo to the location of the config.toml file to use for what ever it does. Config, not content.

I never needed to use the conversion CLI tool, but testing around on my playground it appears that the command does not accept single files but converts ALL files in content to the format you use:

hugo convert toJSON converts all content files to JSON frontmatter.

Many of the additional flags that are in the documentation are not really useful I think, mainly the logging and verbosity ones might help.