Create page templates

Overview

Generally, you operate with the page templates that are based on the default layout file. You modify the default template or create new templates, based on it.

Pure MVC

When creating a new project, by default, the selected framework is MVC. For this mode, you do not have to start creating a new template from scratch. You can use the default template that contains a single placeholder and then modify it further.

Once you select a template and its framework, if you require to base the template on another template at a later point in time, you can select just from the list with templates from the same framework, thus avoiding any shortcomings from switching framework.

.NET Core

You create and manage .NET Core templates in the Templates grid, just like the pure MVC Sitefinity CMS templates.

.NET Core templates are edited with the New page editor of the .NET Core Renderer. To be able to edit the content of a .NET Core template, you must have setup Sitefinity .NET Core Renderer.

Procedure

To create a template via the UI, perform the following:

  1. In the main menu of your website backend, click Design » Page Templates.
  2. Click Create a template.
  3. Enter a name for your template.
  4. In Name used in code, enter the name that will be used to refer to the template in the code.
  5. In Template thumbnail, select the thumbnail that will represent the template in the backend UI.
    If you want to use a custom thumbnail, click Edit (Change) and perform one of the following:
    • Select a thumbnail from the list and click Use selected.
    • Click Upload (Upload), choose an image from your computer, and click Use this image.
  6. Click Continue.
    A list of templates group according to the framework that they are using appears.
  7. Select the template that you want the new template to be based on.
    You can choose between MVC and .NET Core templates.
    If you want to start from scratch, select the respective default template.

    NOTE: The new template will inherit the framework of the template that it is based on.

RESULT: After you select a base template, the new template is created and is in status Draft. It opens in editing mode, so that you can construct it using layout elements and widgets.

Depending on the framework that it is based on, the new template opens for editing in one of the following page editors:

  • The Layout editor opens MVC templates.
    For more information about the Layout editor, see Edit page templates.
  • The New page editor opens .NET Core templates.
    For more information, see The New page editor.

    NOTE: To be able to open a .NET Core template for editing, you must have setup Sitefinity .NET Core Renderer.

Nested templates

When creating a page template based on another template, keep in mind the following:

  • Changes of a template are applied to its child template.
  • You cannot edit the parent template while editing the child template.
  • If you delete a template, all of its child templates and all pages that uses this template will also be deleted.

RECOMMENDATION: When you create a nested page template, based on a layout file, we recommend selecting the MVC only option. For more information about layout base templates, see Create MVC page templates based on layout files.

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?