Default config values not overridden by custom config values

As per the Hugo documentation,
“The user can choose to override that default with one or more site config files using the command-line --config switch.”
However, it seems to me that the default config values actually override the custom config values. Consider the following example:

Some default config

# config/default/config.toml
someParam = "default value"

A custom config file

# my_custom_config.toml
someParam = "new value"

When doing hugo --config my_custom_config.toml I’d expect to have someParam be updated to "new value", but it is not. Removing the line someParam = "default value" from the default config file does produce “new value” as a result, so the values in the config file are definitely being found/used by Hugo, just not when there is a default one present.
Am I doing something wrong here?

Since you didn’t put any link to repository, I can’t test my solution.

So, you can test it and tell whether it works.

Move the config.toml from config/default/config.toml and put it in root of repo. Also rename it to to something like another_config.toml.

With this structure:

./
├── config/
│   └── _default/
│       └── config.toml
└── config-other.toml

you must specify the location of the configuration directory:

hugo --config config-other.toml --configDir config/_default

With this structure:

./
├── config.toml
└── config-other.toml

do this:

hugo --config config-other.toml
2 Likes

@jmooring Unfortunately, both approaches seem to break the resources setup, i.e.
resources.Get "scss/app.scss
starts returning null, where it worked fine beforehand. Any ideas why?

Additionally, my setup uses the Doks theme, which has a bunch of mounts - is it possible they are breaking the resources?

I have no way of answering either of these question without access to either (a) the project repository, or (b) a repository containing a test site that demonstrates the problem.

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.