Create the layout file
To create layout files, perform the following:
- In Visual Studio, open your SitefinityWebApp project » ResourcePackages » [YourPackage].
For more information, see Overview: Resource packages.
NOTE: You can also create the layout file in the root folder of your project: ~/MVC/Views/Layouts. For more information, see Priorities for resolving views.
- Create new folder and name it Layouts.
- In the context menu folder Layouts, and click Add » Code File.
- Name the file in the same way that you named your page template.
For example, if the page template is named mypagetemplate, you must name the layout file mypagetemplate.cshtml
NOTE: The file extension of the layout file depends on the type of view engine you are using. For example, when using Razor view engine, you need to have a .cshtml layout file extension.
NOTE: Replace all special characters in the file name with an underscore “_”.
- Open the layout file you created and paste the following markup:
- In the markup above, you specify the following layout file content:
- using directive for Telerik.Sitefinity.frontend/Mvc/Helpers namespace
- Document type tag <!DOCTYPE html>
- <head> tag
- <body> tag
- Placeholders inside the <body> tag that you create by using a helper method @Html.SfPlaceHolder() that result in drop zones in the corresponding template in the Sitefinity CMS user interface
The helper method accepts the name of the placeholder as an optional parameter.
- Save the file.
RESULT: After Sitefinity CMS restarts, it automatically creates a new page template with a name corresponding to the layout file you created. You can work with the page template straight away by navigating to Design » Page templates.