Creating menu purely in config file

Is there a way to have a menu defined purely in the config file?

In my config.toml file I have:

  [[menu.main_en]]
    identifier = "about"
    name = "about hugo"
    pre = "<i class='fa fa-heart'></i>"
    url = "/about/"
    weight = -110

However, I wasn’t able to render menu using {{ range .Site.Menus.main_en -}} until I added some page to this menu via frontmatter. Is this a correct behavior?

Sure, to add a Child Menu, just add parent to menu entry.

 [[menu.main_en]]
    identifier = "my-post"
    parent = "about"
    name = "post title"
    pre = "<i class='fa fa-heart'></i>"
    url = "/blog/post-title/"

More on Menu Enty

Thanks, but I don’t want to have nested menu. Is there any other way?

I was able to create menu in this manner now. Maybe the problem way in a wrong URL…

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.