Create the layout file

To create layout files, perform the following:

  1. 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.

  2. Create new folder and name it Layouts.
  3. In the context menu folder Layouts, and click Add » Code File.
  4. 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 “_”.

  5. Open the layout file you created and paste the following markup:
     
  6. 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.
  7. 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.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

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.

Was this article helpful?