Wagtail Unboxed episode 09 4:17
Navigation and site settings
The studio site gets a real menu and a footer the client can edit. No menu model, no hard-coded links: the menu is built from the page tree, and the contact details come from Wagtail's site settings.
What this episode covers
And two reasons your first menu will be empty, or won't render at all.
What you'll learn
- Building a menu from the page tree with
in_menu() - A custom inclusion tag, and why the dev server says it doesn't exist
- Why the menu is empty:
show_in_menus, and whatshow_in_menus_defaultreally does - Keeping the right item highlighted on child pages
- Measuring the menu's cost: one query
wagtail.contrib.settingsand its context processorBaseSiteSettingvsBaseGenericSetting- The settings row that creates itself, and why defaults matter
settings.app_label.ModelNamein templates, mailto and tel links
Chapters
- 0:00 A site you can't get around
- 0:22 The menu comes from the tree
- 0:39 An inclusion tag
- 0:53 Not a registered tag library
- 1:04 Restart runserver
- 1:24 The menu is empty
- 1:43 show_in_menus_default
- 1:59 Which item is active
- 2:18 One query
- 2:34 Site settings
- 2:44 A settings model
- 3:00 The row that creates itself
- 3:21 Using settings in templates
- 3:36 The menu on a post
- 3:43 The footer
- 3:57 Commit and tag
- 4:01 Next episode
Versions on screen
Wagtail 7.4.3 · Django 6.1.1 · Python 3.12. Recorded on Windows; macOS and Linux commands are in the repository for every episode.