By default Sitefinity CMS comes with a Navigation widget, see Navigation widget. Although it provides ability to customize the template, for one reason or another, a lot of developers decide to implement custom navigation. Some of the possible reasons is better control on what is displayed or styling the navigation in a way the navigation widget doesn’t support.
There are many ways you can implement a custom navigation. The first idea that comes to mind is using the PagesService in Sitefinity CMS. It will provide you with logic that is ready to be used to retrieve pages and populate the Navigation widget. However, as any of the Sitefinity CMS services each method of the PagesService requires authentication. This is not an option for a control whose purpose is to be used mainly on the frontend. The second idea that comes to mind is to create a custom web service and to use the Pages API. However this will not be an optimal solution in terms of performance. The Pages API exposes additional data, whcih is redundant for navigation widget purposes, thus this approach doesn’t scale. Navigation is one of those things that are rendered everywhere on your site and calling the API on each request is not exactly a performance best practice. Also note that filtering by permissions and current site (when in Multisite environment) and caching are not out-of-the-box provided with the Pages API.
The best solution is to use the Sitefinity CMS SiteMap provider (for example in a custom web service). This gives you better performance by utilizing caching and lazy loading – it only calls for data when needed. You can get an instance of the SiteMap provider in one of the following ways:
Once you have the provider, you can bind, following the ASP.NET standard. For more information, see the MSDN documentation.
For an example of an MVC navigation widget using the Sitefinity CMS SiteMap provider see this sample on the Sitefinity CMS GitHub repo.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2021 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity