As a frontend developer, Sitefinity CMS enables you to control the rendered HTML and modify the markup of MVC widget templates according to your preferences.
All MVC widget templates are located in the ResourcePackages folder in the root of your project. There is a dedicated folder for the Bootstrap framework, supported by Sitefinity CMS.
For more information about frontend frameworks, see Overview: Resource packages.
RECOMMENDATION: When modifying a widget template, to make upgrades easier, we recommend that you do not change the default widget templates. If you need to make changes to a default template, it is generally better to create a new template altogether by duplicating the original template. Only after, you modify and make changes to the duplicated template.
RECOMMENDATION: We recommend that you store the widget templates in your resource package. For information about file priorities, see Priorities for resolving views.
To edit widget templates, you do not need to open the file in Visual Studio and build the project and replace .dll files. You only need to edit the markup of the widget.
In the following example, you are using the Bootstrap package and you modify the markup of the News widget. To do so:
As a result, the template of the News widget is changed.
From the backend
To create a new widget template for the Login form widget in the backend:
<type of widget>
NOTE: The name of your template must start with <type of widget>.
EXAMPLE: If you are creating a template for Login form widget, choose LoginForm (MVC) and start your template name with LoginForm. Once you create the new template, you can use it when you open the Login form widget for editing.
In the file system
The following example demonstrates how to create new News widget template when you are using the Bootstrap package:
NOTE: This approach is not supported when using a Hybrid mode page template. You must use the approach based on the ~/MVC/Views folder structure, documented in the next paragraph.
NOTE: The view name is the name that is used for the file and how it is displayed in the backend. For more information about naming your files, see Naming conventions.
IMPORTANT: If you are creating a template for a dynamic content widget, make sure you follow the naming convention: ~/Mvc/Views/<DynamicContentTypeName>/DesignerView.<ViewName>.cshtml where <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 be named with singular form.
You can also create a new widget template by adding it directly into the file system:
EXAMPLE: If you are creating a template for Login form widget, create a LoginForm folder. IncludeLoginWidget in the name of your new view file.
As a result, you can see the new widget template in the widget designer when you expand the Template dropdown menu:
Back To Top
Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.