Page templates

Overview

Before you populate your page with content, you create the layout that defines how and where content is positioned and displayed on pages. For example, you allocate space for the navigation, the header, and the content blocks. To do this, you use predefined or customized page templates, which you can modify further, if needed. By setting and applying the page template, you basically define the appearance and style of an individual page or all pages.

To see and manage the list of all templates that your website pages are based on, navigate to Design » Page templates.

Types of page templates

In Sitefinity CMS, you can work with three types of page templates, depending on the technology you use and the widgets you place on pages. The mode you use depends on your development process as well as the functionality you want to implement.

The following sections summarize the template types, along with an overview when and how you use them.

Pure MVC

In pure MVC mode, you directly control the markup of templates. You work with Razor layout files and leverage the set of grid widgets, provided by the resource package, which help you customize your layout by dropping them on your pages. Once you need to modify and style your MVC page templates, you do it in the resource package since it groups and organizes all your resources, templates, front-end assets, CSS files, and so on. When working with MVC-only templates, you do not need to work with the Responsive and Mobile design module since the MVC framework is mobile-first. Responsive design is provided by the CSS framework, used in the Bootstrap package, shipped with Sitefinity CMS out-of-the-box.

RECOMMENDATION: Working in MVC mode is the recommended way to work in Sitefinity CMS, especially for new projects. Development process is optimized and modification of your website functionality and appearance – quick and easy.

For more information, see:

Hybrid

Hybrid mode lets the template and all pages, based on it, use both MVC widgets and Web Forms widgets on the same page. Thus, if you have legacy pages with Web Forms widgets, say with Forums, you can still take advantage of MVC technology benefits.

When you create a hybrid template, Sitefinity CMS creates a page object, but also routes to all MVC controllers that you have on the page and inserts their markup into the output. This works in exactly the same way that ASP.NET MVC does, so you can fully expect your widgets to behave like they would normally.

However, you need to be aware of the specifics and dependencies the two technologies entail.

For more information, see Dependencies when working with hybrid page templates.

.NET Core

You can create .NET Core templates in Sitefinity CMS, but you can only use them, if you have setup Sitefinity .NET Core Renderer.

The ASP.NET Core pages are based on Layout files that are stored in the Renderer application. The ASP.NET Core templates are MVC Layout files, stored on the file system. If a page is based on one of these layout files, the Renderer will be able to render the page.

To create a base layout for all of your pages, you can leverage the power of Layout in ASP.NET Core.

Pure Web Forms mode

By default, Web Forms templates are disabled. If required by your scenario, you still have the option to work with Web Forms templates by configuring which frameworks page templates use. To do this, navigate to Administration » Settings » Advanced » Pages and set the Page templates framework to All.

When working with Web Forms, you base your page templates on .master files and define the appearance and style of the page by setting the template and the theme.

For more information, see Create hybrid or Web Forms template using a Master page.

For more information about setting WebForms and hybrid templates through the code, see Apply 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?

Next article

Widget templates