# How to use a custom config file with huge new command

**URL:** <https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089>\
**Category:** support\
**Created:** [July 22, 2018, 9:45am UTC](https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089 "2018-07-22T09:45:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![juh2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/juh2/32/3980_2.png) [@juh2](https://discourse.gohugo.io/u/juh2)\
**Post date:** [July 22, 2018, 9:45am UTC](https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089/1 "2018-07-22T09:45:07Z")

</div>

I have a project with three config files:  
config-development.toml  
config-production.toml  
config-staging.toml

I can do:

```
hugo server --config config-development.toml

```

But not:

```
hugo new blog/2018/test.md --config config-development.toml 
Error: Unable to locate Config file. Perhaps you need to create a new site.
   Run `hugo help new` for details.

```

I tried several variations of the above command but with no success.  
Hugo does not find the custom config file.  
What is the right usage of the hugo new command?

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [July 22, 2018, 12:54pm UTC](https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089/2 "2018-07-22T12:54:34Z")

</div>

I have never tried that command. So I am curious: Why would you need a config file during `hugo new`? It’s likely that `--config` switch is not added to `hugo new` sub command.

---

<div class="post-metadata">

**Author:** ![juh2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/juh2/32/3980_2.png) [@juh2](https://discourse.gohugo.io/u/juh2)\
**Post date:** [July 22, 2018, 1:33pm UTC](https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089/3 "2018-07-22T13:33:01Z")

</div>

hugo help new lists the option --config

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [July 22, 2018, 5:23pm UTC](https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089/4 "2018-07-22T17:23:14Z")

</div>

> [@juh2](#):
>
> Error: Unable to locate Config file.

If can’t find your config.

---

<div class="post-metadata">

**Author:** ![juh2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/juh2/32/3980_2.png) [@juh2](https://discourse.gohugo.io/u/juh2)\
**Post date:** [July 22, 2018, 6:39pm UTC](https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089/5 "2018-07-22T18:39:35Z")

</div>

I hand over another config file with the --config option. This option does not work with the new command at least not here.

Hugo Static Site Generator v0.42.1 linux/amd64 BuildDate: 2018-06-13T10:16:36Z

---

<div class="post-metadata">

**Author:** ![maiki](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/maiki/32/16384_2.png) [@maiki](https://discourse.gohugo.io/u/maiki)\
**Post date:** [July 22, 2018, 7:22pm UTC](https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089/6 "2018-07-22T19:22:48Z")

</div>

I am using a newer version, so that might be it, but it works for me: `Hugo Static Site Generator v0.45 linux/amd64 BuildDate: 2018-07-22T14:40:41Z`

If you need more troubleshooting, you’ll have to share your code. 🙂

---

<div class="post-metadata">

**Author:** ![\_nm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/_nm/32/7662_2.png) [@\_nm](https://discourse.gohugo.io/u/_nm)\
**Post date:** [November 5, 2018, 6:50pm UTC](https://discourse.gohugo.io/t/how-to-use-a-custom-config-file-with-huge-new-command/13089/7 "2018-11-05T18:50:19Z")

</div>

I also had this problem when I partitioned my `config.toml` into 3 configs:

- config-set-theme.toml
- config-shared.toml
- config-theme-name.toml

The way I solved this is to change the name of the first config so that my 3 config files are now:

- config.toml
- config-shared.toml
- config-theme-name.toml

And in config.toml, I set only these variables:

- themesDir
- theme
- newContentEditor

I think the problem is that `hugo new path/to/post` does not respect the `--config` flag and instead looks for `config.toml|yaml|json`. The main thing that’s needed to create a new post is the archetypeDir, which comes as part of my theme settings. Useful, but not necessary, is to launch the new post inside my newContentEditor so I set that in my config.toml too.

Now I can happily run:

`hugo server --config config.toml,config-shared.toml,config-theme-name.toml`

And use the `hugo new path/to/post` command.
