Home > database >  Wagtail page promote tab - "Show in Menu" - How does it work?
Wagtail page promote tab - "Show in Menu" - How does it work?

Time:03-04

The default Wagtail page model includes the "Show in Menu" option on the promote tab. I've been searching through the documentation for awhile now trying to find more information about how this works and I don't see anything.

What is this option used for, and how do I hook into that field so that I can build a simple list of links to be used is some arbitrary template like a footer?

Am I supposed to just build my own queryset of page models and then filter on that value, or is there a simpler utility include with Wagtail that I can use directly?

CodePudding user response:

The Wagtail Getting Started section could use some information about how to use 'show in menu' to create menus. Until that gets added, try this tutorial for how to use this 'from scratch': https://www.accordbox.com/blog/how-to-create-and-manage-menus-in-wagtail/

Or install wagtailmenus per instructions in this tutorial: https://engineertodeveloper.com/wagtail-site-navigation/

(At work we built ours by hand but if we were doing it over, I would definitely look into wagtailmenus)

CodePudding user response:

This is a generic field that is available on Page models that does not do anything by default.

https://docs.wagtail.org/en/stable/reference/pages/model_reference.html?highlight=show_in_menua#wagtail.core.models.Page.show_in_menus

While the documentation is not the clearest, the only thing this impacts is whether the page is returned in in_menu() querysets.

https://docs.wagtail.org/en/stable/reference/pages/queryset_reference.html#wagtail.core.query.PageQuerySet.in_menu

As Wagtail does not make assumptions about what your frontend (front facing pages) will look like it is up to you to determine what this field means for your application.

Additional links

  • Related