Did this article resolve your question/issue?



How to implement IContentLocatableView for custom widgets

« Go Back


TitleHow to implement IContentLocatableView for custom widgets
URL Namehow-to-implement-icontentlocatableview-for-custom-widgets
Article Number000187581
EnvironmentProduct: Sitefinity
Version: 5.x, 6.x, 7.x, 8.x, 9.x, 10.x, 11.x, 12.x, 13.x, 14.x
OS: All supported OS versions
Database: All supported Microsoft SQL Server versions
Question/Problem Description
How to implement  IContentLocatableView for custom widgets.
How to track what pages display content items?
How to add content locations when using custom widgets?
Preview is not working for content items displayed in custom widgets.
No pages are shown to display a certain content type.
Sitemap generator its not crawling items in custom widgets.
Steps to Reproduce
Clarifying Information
IContentLocatableView provided the functionality to track on what pages content items from a module are published. This is available out of the box for Sitefinity built-in widget and has to be manually implemented in the custom widget. It is also used for the preview of content items and for issuing a canonical link element for SEO. 
Error Message
Defect Number
Enhancement Number

Support for content locations can be implemented in custom widgets and those widgets will automatically add content locations for all items they render sample like the built-in Sitefinity widgets.

The sample widgets that implement IContentLocatableView the API for modules built with the module builder. Refer to the attached which contains a widget that implements IContentLocatableView. 

The interface supports MVC widgets. For WebForms widgets, the requirements for supporting this is that the widget does not inherit from UserControl, so it must be SimpleView or SimpleScriptView control. 

Additionally attached is also a sample that allows multiple types to be managed by the IContentLocatableView in a single widget. This is covering the case where a single widget is used to render info from multiple modules. Refer to the attached

The method that provides the functionality of ICotnentLocatableView, GetLocations() accepts a list of ContentLocationInfo where the developer needs to add all modules types that are used in the widget, create a list of IContentLocationInfo and then fill it with ContentLocationInfo for each of the modules that are in use for this widget.

public System.Collections.Generic.IEnumerable<IContentLocationInfo> GetLocations()
           //prepare list for all locations
           var locations = new List<IContentLocationInfo>();
           //add each module location specifics
           var locRamsModule = new ContentLocationInfo();
           locRamsModule.ContentType = TypeResolutionService.ResolveType(ramsModuleType);
           locRamsModule.ProviderName = dynamicModuleManager.Provider.Name;
           var locSmallRamsModule = new ContentLocationInfo();
           locSmallRamsModule.ContentType = TypeResolutionService.ResolveType(smallRamsModuleType);
           locSmallRamsModule.ProviderName = dynamicModuleManager.Provider.Name;
           var locMicroRamsModule = new ContentLocationInfo();
           locMicroRamsModule.ContentType = TypeResolutionService.ResolveType(microRamsModuleType);
           locMicroRamsModule.ProviderName = dynamicModuleManager.Provider.Name;
           var locRambosModule = new ContentLocationInfo();
           locRambosModule.ContentType = TypeResolutionService.ResolveType(RambosModuleType);
           locRambosModule.ProviderName = dynamicModuleManager.Provider.Name;
           // move all locations
           return locations;
       string ramsModuleType = "Telerik.Sitefinity.DynamicTypes.Model.Rams.Ram";
       string smallRamsModuleType = "Telerik.Sitefinity.DynamicTypes.Model.Rams.Smallram";
       string microRamsModuleType = "Telerik.Sitefinity.DynamicTypes.Model.Rams.Microram";
       string RambosModuleType = "Telerik.Sitefinity.DynamicTypes.Model.Rams.Rambo";
References to Other Documentation:
Progress Article:
Last Modified Date10/8/2021 12:24 PM
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.