qwik icon indicating copy to clipboard operation
qwik copied to clipboard

[✨] Allow for multiple keyed menus with useContent

Open watzon opened this issue 2 years ago • 0 comments

Is your feature request related to a problem?

Currently it seems like it's only possible to define a single menu inside of menu.md. This makes it frustrating to account for the possibility of multiple menus, such as a header menu and a footer menu (which will probably contain a basic sitemap).

Describe the solution you'd like

There are a couple good ways I can think of handling this. Keep in mind that I have done zero digging into the code to see how things are structured, so take these with a grain of salt.

  1. Allow for multiple menus to be defined in menu.md using top level headings. For example:
    # Header
    
    ## [Home](/)
    
    ## [About](/about)
    
    # Footer
    
    <!-- Other footer specific menu items -->
    
  2. Allow for multiple menu.md files the same way we allow for multiple layouts, and allow useContent to accept an identifier as a parameter. So useContent() would use menu.md, while useContent('footer') would use menu-footer.md.

Describe alternatives you've considered

The obvious one is to just hard code the menu into the component, use a json file, or use an exported javascript object from another file. This is how I will probably handle the problem for now, but I wanted to bring this idea up for discussion anyway.

Additional context

No response

watzon avatar Jan 05 '23 23:01 watzon