Split config into multiple files?

Hi everyone,
I am working on a test site at the moment and wanted to know if it was possible to split my config file into smaller files e.g. theme.json, settings.json, foo.json and so on?

config
     |_ _default
         |_ theme.json
         |_ params.json
         |_ foo.json

I know there’s a menu.json and some reserved Hugo terms but not sure if this is possible??

I tried this but it didn’t render anything:

Thanks in advance.

https://gohugo.io/getting-started/configuration/#configuration-directory

1 Like

thank you, I saw that but was not sure if that was the way I wanted since I don’t layout my files for development, production and so on, not sure why I when I tried to split the config file down it didn’t render as per the article I added.

Sorry, I guess I don’t understand. What is foo.json for?

sorry was me not being really clear.

So I have this stucture:

├── config/
       └── _default/
             └── config.json

But since my config.json file is big in size with a lot of lines of code, could it be possible to break it down into small files? So if in my config.json I have a block called foo, could I create a new foo.json file inside my _default folder and split my config file out like that?

so then I would have a file called foo.json with the following:

{
    "foo": "bar"
}

Make sense?

You can split by the predefined top-level keys only.

You might consider using the data directory.

2 Likes