11.3. About the sidebar menu items for your Developer Hub instance
The sidebar menu in Red Hat Developer Hub consists of two main parts that you can configure:
- Dynamic plugin menu items
- Your preferences and your active plugins define dynamically one part of the sidebar menu.
- Main menu items
The core navigation structure of sidebar is static.
- Dynamic plugin menu items: These items are displayed beneath the main menu and can be customized based on the plugins installed. The main menu items section is dynamic and can change based on your preferences and installed plugins.
Customize the main menu items using the following steps:
Procedure
Open the
app-config.yamlfile.-
To customize the order and parent-child relationships for the main menu items, use the
dynamicPlugins.frontend.default.main-menu-items.menuItemsfield. -
For dynamic plugin menu items, use the
dynamicPlugins.frontend.<package_name>.menuItemsfield.
-
To customize the order and parent-child relationships for the main menu items, use the
Example app-config.yaml file
dynamicPlugins:
frontend:
default.main-menu-items:
menuItems:
default.home:
title: Home
icon: home
priority: 100
enabled: true
default.my-group:
title: My Group
icon: group
priority: 90
enabled: true
default.catalog:
title: Catalog
icon: category
to: catalog
priority: 80
enabled: true
default.apis:
title: APIs
icon: extension
to: api-docs
priority: 70
enabled: true
default.learning-path:
title: Learning Paths
icon: school,
to: learning-paths
priority: 60
enabled: true
default.create:
title: Self-service
icon: add
to: create
priority: 50
enabled: true
Configure a dynamic plugin menu item using the following step:
Procedure
In the
app-config.yamlfile, update themenuItemssection of your <plugin_name> plugin. For example:dynamicPlugins: frontend: _<plugin_name>_: menuItems: <menu_item_name>: icon: # home | group | category | extension | school | _<my_icon>_ title: _<plugin_page_title>_ priority: 10 parent: favorites enabled: true<plugin_name>-
Enter the plugin name. This name is the same as the
scalprum.namekey in thepackage.jsonfile. <menu_item_name>-
Enter a unique name in the main sidebar navigation for either a standalone menu item or a parent menu item. If this field specifies a plugin menu item, the name of the menu item must match the name using in the corresponding path in
dynamicRoutes. For example, ifdynamicRoutesdefinespath: /my-plugin, thenmenu_item_namemust be defined asmy-plugin. icon(Optional) Enter the icon name. You can use any of the following icons:
-
Default icons, such as
home,group,category,extension, andschool. To use default icons, set the icon as an (" ") empty string. - A custom icon, where <my_icon> specifies the name of your custom icon
-
An SVG icon, such as:
icon: <svg width="20px" height="20px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" fill="#ffffff">…</svg> -
An HTML image, such as:
icon: https://img.icons8.com/ios-glyphs/20/FFFFFF/shop.png
-
Default icons, such as
title-
(Optional) Enter the menu item title. Omit it when the title is already specified in the
dynamicRoutesconfiguration undermenuItem.text. To hide the title from the sidebar, set the title as an (" ") empty string. priority- (Optional) Sets the order in which menu items appear in the sidebar. The default priority is 0, which places the item at the bottom of the list. A higher priority value places the item higher in the sidebar. You can define this field for each section.
parent-
(Optional) Enter the parent menu item under which the current item is nested. If this field is used, the parent menu item must be defined elsewhere in the
menuItemsconfiguration of any enabled plugin. You can define this field for each section. enabled-
(Optional) If this field is used to hide the menu item from the sidebar, set the value to
false. To display the menu item in the sidebar, set the value totrue.
dynamicPlugins: frontend: _<package_name>_: dynamicRoutes: - path: /my-plugin module: CustomModule importName: FooPluginPage menuItem: icon: fooIcon text: Foo Plugin Page menuItems: my-plugin: priority: 10 parent: favorites favorites: icon: favorite title: Favorites priority: 100my-plugin-
Matches the value of the
pathfield indynamicRoutes. priority- Controls order of plugins under the parent menu item.
parent-
Nests this plugin under the
favoritesparent menu item. favorites- Configuration for the parent menu item.
icon-
Displays the
favoriteicon from the RHDH system icons. title- Displays the title name for the parent menu item.
priority-
Order of the
favouritesmenu item in the sidebar.
Modify a main menu item or add a custom menu item using the following step:
Procedure
In the
app-config.yamlfile, add a section to thedefault.main-menu-items>menuItemssection. Use thedefault.prefix to identify the key as a main menu item.dynamicPlugins: frontend: default.main-menu-items: menuItems: default._<menu_group_parent_item_name>_: icon: # home | group | category | extension | school | _<my_icon>_ title: _<menu_group_parent_title>_ priority: 10 default._<menu_item_name>_: parent: _<menu_group_parent_item_name>_ icon: # home | group | category | extension | school | _<my_icon>_ title: _<my_menu_title>_ to: _<path_to_the_menu_target_page>_ priority: 100 enabled: truedefault.<menu_group_parent_item_name>-
(Optional) Enter the menu group parent item name to configure static main menu items. If no
default.<menu_item_name>has aparentvalue set, this field is not needed. icon- Enter the menu icon. Required for parent menu items.
title- Enter the menu group title. Required for parent menu items.
priority- (Optional) Enter the order of this menu item within its menu level.
default.<menu_item_name>-
Enter the menu item name for which you want to override the default value. Add the
default.prefix to identify a main menu item. parent- (Optional) Enter the parent menu item for this item. Required if <menu_item_name> is specified as the child of any menu items.
icon-
(Optional) Enter the menu icon. To use the default icon, set the icon as an (
" ") empty string. title-
(Optional) Enter the menu group title. Only required for adding a new custom main menu item. To hide a default main menu item title from the sidebar, set the title as an (
" ") empty string. to- (Optional) Enter the path that the menu item navigates to. If it is not set, it defaults to the home page.
priority- (Optional) Enter the order of this menu item within its menu level.
enabled-
(Optional) If this field is used to display the menu item in the sidebar, set the value to
true. To hide the menu item from the sidebar, set the value tofalse.
default.main-menu-items: menuItems: default.catalog: icon: category title: My Catalog priority: 5 default.learning-path: title: '' default.parentlist: title: Overview icon: bookmarks default.home: parent: default.parentlist default.references: title: References icon: school to: /references enabled: trueicon- Specifies if you want to change the icon default menu item for the catalog.
title-
Specifies an empty string
" "to hide the learning path from the default sidebar. default.parentlist- Introduces the parent menu item.
parent-
Nests home menu under the
default.parentlistparent menu item. title-
Specifies a name for
default.references icon-
Displays the
schoolicon. to-
Redirects
default.referencesto the/referencespage. enabled-
(Optional) If this field is used to display the menu item in the sidebar, set the value to
true. To hide the menu item from the sidebar, set the value tofalse.