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 WCF service and to use the Pages API. However this will be a very bad solution in terms of performance. Pages API for navigation will only expose data and 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 create a custom WCF service and use the Sitefinity CMS SiteMap provider. 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.
Back To Top