How best to model a website menu

I’m trying to decide how best to model a menu for a website that has multiple levels. Part of me thinks a JSON field since it won’t change often? I’m struggling on this one. Any tips or articles?

It’s best to avoid JSON for this, as it is hard to validate,

If you don’t require your menu to be editable by your editors, it’s best to keep it in in your code base.

If you do require editors to edit it then you can create a content typle called “Menu” or similar, and have a multiple reference field which is validated to either contain other Menu entries, or content entries.

You can then add entries for each top level Menu item, and add child menu items within those entries as need, finally referencing the content you which to display as the leaf in each menu tree.

3 Likes