Menus generated from config?

I embed the menu weights as part of menu names. That way, I need zero menu config in my site config.

The menu names are are “0.search”, “1.foo”, and so on. I rarely add/remove menus, so I don’t need to renumber the weights.

Then when .Site.Menus is looped, it will go through those menus in alpha(numerical) order, and I get the menu order as expected (set by the weight prefixes).

About the editing flow: In my flow, I write all posts in tree structure. So the menu name set at the tree node propagates to the children nodes. So I need to set the menu name just once. An alternative would be to have some sort of script to set the menu names.

But all of that would be a huge overkill, and setting the menu weights in the site config would eventually be better… and so I striked out that suggestion.

2 Likes