Feather provides you with a powerful way to add new page templates in MVC.
Every time, when you add a new layout file inside folder ~/MVC/Views/Layouts, Feather generates a pure MVC page template with a title matching the layout file name. This way you can immediately start using this template that is based on the layout file.
NOTE: The template and the layout file are connected via the naming convention.
If you rename the layout file the relationship with the page template breaks and a new page template is created.
Another way to create page templates is to use packages. Packages are suitable for cases when you want to base your templates on frontend frameworks, such as Bootstrap, SemanticUI etc. In order to use it, you need to add the package to folder ResourcePackages folder in your project. You can accomplish the same, if you add the layout file inside folder ~/ResourcePackages/YourPackageName/Mvc/Views/Layouts that is included in the same package. The template will follow the convention and will be titled <package name>.<layout file name>. For example, Bootstrap package has the default.cstml created by default, which creates the Bootstrap.default page template in Sitefinity.
NOTE: If folder ResourcePackages does not contain any packages, the widget templates are loaded from Feather or from the MVC folder of SitefinityWebApp, in case this folder contains files with names that follow the naming convention. Templates from the source of Feather have the lowest loading priority, templates in the MVC folder of SitefinityWebApp have higher priority, and templates from a package have the highest loading priority.
If you delete the generated page template, it will not be generated again, unless you delete and then re-add the layout file while you have the Sitefinity CMS instance up and running as a process. Another option is to manually create a pure MVC page template that follows the naming convention. For example, if you have a MyMvcLayout.chtml file, the template must be titled MyMvcLayout. If the file is inside a package named MyPackage, the template must be named MyPackage.MyMvcLayout.
If you delete the layout file the generated page template will continue to exist, but will not be based on anything. Later, if you add a layout file that matches the naming convention for that template, an additional template will not be generated and the previous template will use this layout again.
If you have a package including multiple layouts, corresponding templates will be automatically created for each of them.
Back To Top