Can't get cast menu maps

Hi,
So I had read this Cannot get hugo to cast menu maps but do not understand everything.
What I understood is that putting alla config files together into one config.toml will work… ans it does.
But, I want to split it into several ones into the configDir/_default

What shall I do for this to work ?

Each file represents a configuration root object, such as params.toml for [Params], menu(s).toml for [Menu], languages.toml for [Languages] etc…

Take the menu as an example.

config.yaml
title: Hello

menu:
  main:
    - name: Foo
    - name: Bar

Equals to

config/_default/config.yaml
title: Hello
config/_default/menu.yaml
main:
  - name: Foo
  - name: Bar

You’ll notice that there isn’t a menu key in config/_default/menu.yaml.

Learn more on Configuration Directory.

Thanks for your reply.
I think I did it right…
Structure :
/config.toml
config/_default/languages
config/_default/menus.fr.toml
config/_default/params.toml

And into the files :

config.toml :

configDir = 'config/'
languageCode = "fr-FR"
defaultContentLanguage = 'fr'
defaultContentLanguageInSubdir = false (That one might be set to  true  I think.... ? I have organise the /content with content/fr and content/en)

========================
languages.toml

[languages]
    [languages.fr]
      weight = 0
      languageName = "Français"
      contentDir = "content/fr"
      title = "tittre Français"
    [languages.en]  
      weight = 2
      languageName = 'English'
      contentDir = 'content/en'
      title = "Title English"

========================
menus.fr.toml avoid [[languages]] then

[[languages.fr.menu.main]]
	name = 'Services'
	url = 'fr/pages/services/'
    weight = 1

[[languages.fr.menu.main]]
    name = 'Projets'
    url = '/fr/projets'
    weight = 2

You’ll notice that there isn’t a menu key in config/_default/menu.yaml.

Do you mena I shall remove, not only [[languages]] but even the [[languages.fr.menu.main]] ? The name of the file menu.fr.toml is enough to say this menu is in french ?

Yes.

Similar to the menu.yaml, it’s no need to specify the root key of the corresponding configuration file.

For example, the languages.toml should be:

[fr]
...
[en]
...

menus.fr.toml:

[[main]]
name = 'Services'

[[main]]
name = 'Projets'

Real examples of my sites: in YAML and in TOML

Thanks my understanding of the whole staff improved a lot.

I thinks things are working now because hugo send back an error about the headings, which include the menu. So I guess it processes the menus properly now.

I would have another question about configuration : on your theme, the config.toml file itself is included into the /config/default. Does it means that, out of themes, the root of the site itself don’t need a config.toml out of the configDir ? And, why not using hugo.toml ? (may be you disegned your theme for version older than 0111, right ?

Yes, requires Hugo >= v0.110.0, see hugo.toml vs config.toml.