
Drupal 10 Development Cookbook
By :

Drupal allows you to link content being authored to a specified menu on the website, generally the main menu. You can, however, create a custom menu to provide links to content. In this recipe, we will show you how to create a custom menu and link content to it. We will then place the menu as a block on the page, in the sidebar.
This recipe assumes that you have installed the standard installation profile and have the default node content types available for use. You should have some content created to create a link.
Sidebar menu
and click on Place block.Menus and links are part of Drupal core. The ability to make custom menus and menu links is provided through the Menu UI
module. This module is enabled on the standard installation but may not be in others.
The Link input of the menu link form allows you to begin typing content titles and easily link them to existing content. It will automatically convert the title into the internal path for you. Link input also accepts a regular path, such as /node/1
or an external path. You may use <front>
to link to the home page, <nolink>
to render a non-linked anchor tag, and <button>
for a keyboard-accessible text-only link.
Links can be managed through the content edit form itself, which will be covered next.
A piece of content can be added to a menu from the add or edit form. The menu settings section allows you to toggle the availability of a menu link. The menu link title will reflect the content’s title by default.
The parent item allows you to decide which menu and which item it will appear under. By default, content types only have the main menu allowed. Editing a content type can allow for multiple menus or only choosing a custom menu.
This allows you to populate the main menu or complimentary menu without having to visit the menu management screens.