We should introduce more advanced menu management on this demo site, to demonstrate Wagtail’s capabilities that are relevant on real-world projects, and so we can improve this type of interface in the CMS.
As-is menus
Currently this demo site has a very simple main menu implementation that relies on Wagtail’s built-in show_in_menus:
|
def top_menu(context, parent, calling_page=None): |
|
menuitems = parent.get_children().live().in_menu() |
|
for menuitem in menuitems: |
There are no other menus on the site.
Desired state
Either refactor the main menu to use StreamField blocks, or introduce a new "footer menu" using blocks, or both. This would include support for:
As an example, see the wagtail.org navigation models and blocks.
Working on this
I think the first step should be confirming whether we want to do this for the existing main menu, or a new footer menu, or both. It’s probably simpler to do it for the footer first, but ideally in a way that is suitable for both use cases.
For the footer, we can have a two-level menu like wagtail.org, where the first "sections" level are headings that aren’t clickable, and within each section there is a list of menu items. Each of which can be links to pages, or external, or documents.
Noting the likely amount of StreamField nesting for #539:
- ListBlock or StreamBlock of "menu sections"
- StructBlock per "menu section" with heading field, and "menu items" ListBlock
- ListBlock or StreamBlock of "menu items"
- StructBlock per "menu item", with relevant fields, including a "link" StreamBlock
- StructBlock per link type
We should introduce more advanced menu management on this demo site, to demonstrate Wagtail’s capabilities that are relevant on real-world projects, and so we can improve this type of interface in the CMS.
As-is menus
Currently this demo site has a very simple main menu implementation that relies on Wagtail’s built-in
show_in_menus:bakerydemo/bakerydemo/base/templatetags/navigation_tags.py
Lines 30 to 32 in 6a16f1b
There are no other menus on the site.
Desired state
Either refactor the main menu to use StreamField blocks, or introduce a new "footer menu" using blocks, or both. This would include support for:
As an example, see the wagtail.org navigation models and blocks.
Working on this
I think the first step should be confirming whether we want to do this for the existing main menu, or a new footer menu, or both. It’s probably simpler to do it for the footer first, but ideally in a way that is suitable for both use cases.
For the footer, we can have a two-level menu like wagtail.org, where the first "sections" level are headings that aren’t clickable, and within each section there is a list of menu items. Each of which can be links to pages, or external, or documents.
Noting the likely amount of StreamField nesting for #539: