Skip to content

Configuring the navbar

deby edited this page May 5, 2019 · 8 revisions

↑ Parent: Tutorials

← Previous: Single pages

You might not want all your links to pages and collections to be on the nav bar itself, but in dropdown lists instead.

To achieve that, you may specify a navbar_link_list in your page or collection settings. It's a string that corresponds to the name of a list.

By default, your website will already contain 2 lists: you and more.

You may add more lists in your settings:

from magi.default_settings import DEFAULT_ENABLED_NAVBAR_LISTS

ENABLED_NAVBAR_LISTS = DEFAULT_ENABLED_NAVBAR_LISTS
ENABLED_NAVBAR_LISTS['stuff'] = { ... }

The settings of a navbar list may contain:

Key Value Default Example
icon String name of a flaticon that illustrates the nav bar list None 'fingers'
image Path to image that illustrates the nav bar list None 'stuff.png'
title Localized name of the list or function that takes the context and return a string required
headers A list of (header name, dict { icon or image, title, small (default = True)) which will be displayed as headers within the dropdown list None 'headers': [ ('social-header', { 'icon': 'settings', 'title': 'Social stuff', }) ]
order The list of link names and header names in the order you'd like to see them under the navbar. For collections, the name will generally be name_list (example: activity_list) None (order not guaranteed) ['activity_list', 'account_list', 'donate_list', 'social-header', 'discord', 'twitter']

Example of a dropdown list, ordered, with a divider, and a header:

→ Next: References

I. Introduction

II. Tutorials

  1. Collections
    1. MagiModel
    2. MagiCollection
    3. MagiForm
    4. MagiFiltersForm
    5. MagiFields
  2. Single pages
  3. Configuring the navbar

III. References

IV. Utils

V. Advanced tutorials

VI. More

Clone this wiki locally