When working with MVC-based widgets and templates, you create and manage files of specific types and 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.
The following table summarizes how you name your files and where you store them:
Designer view
For example, you are creating a designer view, named Custom, for a News widget.
A template for the custom view in the widget designer.
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.
A JSON file that defines a set of additional scripts (and their dependencies), required by the designer view, to be rendered.
JSON
Has the same name as the view template.
~/MVC/Scripts/News/Custom
designerview-custom.js containing AngularJS controller named CustomCtrl
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.
The following table summarizes the naming conventions of frontend views of MVC widget types.
Widgets with List and Detail views:
This list also includes any dynamic content widget.
You need to use the view name.
When working with dynamic content widgets, the name of the folder must correspond to the name of the content type.
In the example, Horizontal is a unique template name that will be displayed in the Templates dropdown menu. You can replace the name with one that suits your needs.
The custom view must be placed in a folder that corresponds to the controller name (without the Controller suffix).
IMPORTANT: You need to have the NavigationView in the beginning of your view name, so that the template is associated with the Navigation widget.
Write.<NameOfTemplate>.cshtml
Read.<NameOfTemplate>.cshtml
Substitute <NameOfTemplate> with a name of your choice.
Most of these fields are dropped in form editor and are therefore referred to as form fields.
IMPORTANT: The form editor is package agnostic, you need to place the new widget templates in the root of your project ~/Mvc/Views/<NameOfWidget>.
Default
ContentBlockController
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