Simplest configDir structure


#1

I’ve been using this command-line argument when I run hugo:

--config config.yaml,config-shared.yaml

I’d like to switch to using the new configDir and tried this structure:

config
└── _default
    ├── config.yaml
    └── shared.yaml

But it did not work. I don’t need different development and production configs. I just want to partition my config file into multiple files so it’s easier to plug and play the different parts.

What’s the simplest way to structure configDir to do this?

BTW, if you are interested, I wrote about why the name of one of my config files needs to be config.yaml (or .toml or .json) when used after the --config command-line flag here:


#2

Just to rule it out, you’re using version 0.53?


#3

Yes I’m using Hugo v0.53. I’ve done some experiments and I think I’ve figured out that this:

root
- config.yaml

is equivalent to this:

root
- config
-- _default
--- config.yaml

So I think this structure (config/_default/config.yaml) is the answer to my original question. Now I have a couple more configDir questions:

  1. How do I specify 2 or more config files in the config/_default directory. From what I’ve read in the (so far) meager documentation, multiple config files are read lexically, which I assume means they are ordered alphanumerically?
  2. I tried setting --configDir ".." on the command line because I’d like to pull my config files out of my project root. It seems that this might actually change the project root from the directory I run hugo in. Please explain how paths work with --configDir and how that is related to the value of the project root directory.

Thank you!