Languages.en.menus.main.yml

I have created the following files including an array of menu entries in my config directory.

languages.en.menus.topbar.yml
languages.en.menus.main.yml
languages.en.menus.footer.yml

Currently, as far as I can see, Hugo does not allow the root of the config file to be an array in this case, and I have to combine three menus into one languages.en.menus.yml with object keys topbar, main, and footer.

Yet, since I have a mega main menu with lots of entries, I prefer keeping them separate for maintenance purposes.

Is there another way to separate menus into different config files?

Thanks

No.

If you have too much time on your hands you could write a bash script that combines (merges) these single files to the final config file, but it’s not a GoHugo feature.

You could add the menu entry for each single item into their respective content file. That however would probably be even more un-intuitive for you. I prefer it in the content files, because if I change the link, slug or url of the content file it stays in the menu and receives the proper link immediately, without me having to change the menu config. But that’s all the advantage. If you want a quick overview about your mega-menu you won’t get it easily this way.