This sample demonstrates how to build a custom navigation menu with nested child widgets. It is useful for large sites where the sitemap does not fit into one or two levels. Additionally, you can use the sample to insert custom widgets inside the menu and display them when hovering over a specific page.
You can choose from the following options:
PREREQUISITES: You must set up a Sitefinity renderer application and connect it to your Sitefinity CMS application. For more information, see Install Sitefinity in ASP.NET Core mode.
NOTE: The instructions in this sample use Visual Studio 2022 and a Sitefinity renderer project named Renderer.
Under your Renderer project, you must create the following folders:
Entities
MegaMenu
Models
ViewModels
ViewComponents
Views
Shared
Components
wwwroot
styles
You must register the scripts in the _Layout.cshtml file. You must then use this custom base layout for every page where the MegaMenu is placed
_Layout.cshtml
Perform the following:
Views/Shared
Entity
Entities/MegaMenu
Model
Models/MegaMenu
ViewModel
ViewModels/MegaMenu
ViewComponent
View
Views/Shared/Components/MegaMenu
_LayoutImports
The Program.cs file should look in the following way:
Program.cs
Views/Shared/Components
wwwroot/styles
edit
Build your solution.
When you open your Renderer application and open the New editor, you will see the MegaMenu widget in the widget selector. When you add the widget on your page and edit it, you can choose which pages to be part of the menu and how to display them.
Renderer
This sample is available in Sitefinity’s GitHub repository. You can run and play with it. To do this, perform the following:
sitefinity-aspnetcore-mvc-samples-master/src/mega-menu
mega-menu.sln
appsettings.json
“Sitefinity”
“Url”
mega-menu
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important