Create MVC page templates based on layout files
Say you created a layout file, according to the naming conventions for Sitefinity CMS MVC development and place it in a specific folder in the file system. You can now use your layout file to base page templates on. Or, say your layout file was located in a location, different than your Bootstrap 4 resource package folder. You want to place the layout file in its recommended location.
NOTE: Keep in mind that this is a corner case that you will not usually encounter when following the general workflow of working with page templates.
After you place your layout file in a project folder of your choice (in the root of the project or in the Resource packages folder), in Sitefinity CMS backend, you need to create an MVC page template that is associated with the layout file. Thus, you can work with and modify the template and use it in pages. When you base a page template on a layout file you created, you have full control over the file and can directly edit it from Sitefinity CMS backend. You can also add widgets to the template.
The following table summarizes how to base a page template on a layout file, depending on where the file is located.
Layout file location
Page template mapping
(does not belong to any package)
Navigate to Design»Page templates and create an MVC only template with a name that corresponds to the name of the layout file on the file system.
For example, if you want to use the Main.cshtml file, located in the mvc/views/layouts/ folder, navigate to Design » Page templates and create an MVC only template with name and developer name Main.
Navigate to Design » Page templates and create an MVC only template with a name that abides by the naming convention [resource-package-name].[file-name]. For more information, see Naming conventions.
For example, if you want to use the Main.cshtml file, located in the resourcepackages/bootstrap5/mvc/views/layouts/ folder, navigate to Design » Page templates and create an MVC only template with name and developer name Bootstrap5.Main.
This mapping works the other way around as well. For example, if you have page templates in Sitefinity CMS that are not based on layout files on the file system, you can create the layout files following the naming convention and they are automatically mapped. For more information, see Base MVC page templates on layout files.