Naming conventions

When working with MVC-based widgets and templates, you create and manage files of specific types and generally store them in a specific location in your project. You follow naming conventions that define how Sitefinity CMS prioritizes and resolves views and assets like scripts, for example.

Say you are creating a designer view, named Custom, for a News widget. The following table summarizes how you name your files and where you store them: naming conventions and location of the files you need:

Name of Convention Location of file Description 
Razor view  Custom.cshtml ~/MVC/Views/News/Custom  The widget template file.
Designer view  DesignerView.Custom.cshtml ~/MVC/Views/News/Custom 

A template for the custom view in the widget designer.

Designer view for dynamic content widget  DesignerView.Custom.cshtml ~/Mvc/Views/<DynamicContentTypeName>/Custom 

A template for the custom view of a dynamic content type widget. <DynamicContentTypeName> is the name of the dynamic content type, for example Country. If you created a dynamic type with name Countries, the folder name must still be named with singular form.

JSON configuration  DesignerView.Custom.json  ~/MVC/Views/News/Custom 

JSON file that defines a set of additional scripts (and their dependencies),  required by the designer view, to be rendered.

Has the same name as the view template.

Script  designerview-custom.js


designerview-custom.js containing AngularJS controller named CustomCtrl

A JavaScript file with custom client-side logic. Needs to be in the same location as the custom view, so that it overrides the default script file. 
Angular controller CustomCtrl The controller that handles the populating and saving of widget properties through the designer.

In addition, Sitefinity CMS follows a strict convention for resolving views for widgets, based on where the view files are located. For details, see Priorities for resolving views.


Was this article helpful?