How to create new site with YAML config?

I realize this is a stupid question but I can’t figure it out. hugo new site --help tells me:

–config string config file (default is path/config.yaml|json|toml)

but no matter no I format the string passed to --config, the resulting site always contains the default configuration file in TOML format.

I’ve tried hugo new site test/ --config test/config.yaml, --config="test/config.yaml", --config yaml, putting the flag before the path, all the variations I can think of.

I would just rename the default config.toml to config.yaml (and change the contents to the use the correct format). Once you do that, make your config changes. Next, you should be able to run hugo config and it will show you all of the config values that it finds. That will tell you that it is finding the correct file.

Hopefully this helps!

Right, and that’s exactly what I always do. It just annoys me a little.

Apparently the --config global flag allows you pass in different (existing) configurations, which sounds useful, just not what I wanted/expected in this case. I think the documentation could make the purpose of that flag a little more clear.

On top of that, hugo convert toYAML seems to only convert front matter, not configuration.

I would love to see an option added to define the type of configuration file created on a new site (or at least allow toYAML and friends to convert configuration along with front matter).

That would be a nice feature to have. I personally prefer YAML over TOML for my configs and I always have to convert them manually at the moment…

1 Like

Try https://toolkit.site/format.html. I use it at times, for the reverse scenario … to understand how my TOML table or table of tables would look in YAML :slight_smile:

1 Like

Interesting. Thanks for the link!

I usually just use a custom Python script to convert between formats :slight_smile:

Bit late but:

hugo new site <SITE_NAME> -f "yaml"