How to create a dynamic menu in Jekyll that auto-populates nav items when creating new pages

Also for interest see the jekyll menus plugin. I haven’t tried it but allows nesting of menus and setting of weights and it looks like either frontmatter or a data file.