Mobile formats templates

Modify the mobile format templates

The mobile format page does not look like the original content item page. To modify the look of the mobile format page, you need to modify its Layout and Content item templates. The templates are located in the File System under ~/MVC/Views/<Format name>/

There are two kind of templates – Layout and Content item templates.
Layout templates can be shared across all content types and are suitable for common parts in the UI such as the logo, header, navigation bar, footer section, etc. Content item templates are specific per content type and are designed to define the look of a single content item of the given content type.

The names of the templates must be in the following format:

  • Layout templates – Layout.<Template name>.chtml
    For example, Layout.Default.cshtml
  • Content item templates – <ModuleName>.<ContentTypeName>.<Template name>.chtml
    For example, News.NewsItem.Default.cshtml

IMPORTANT: When modifying the templates, you must follow the rules and restrictions of the Mobile format - Google AMP.

Create new mobile format template

You can create your custom templates to use different templates across different sites.
To create and configure your custom template, perform the following:

  1. Navigate to ~/MVC/Views/<Format name>/ directory
  2. Create a file with one of the following file names:
    • Layout.<Template name>.chtml for Layout templates
    • <ModuleName>.<ContentTypeName>.<Template name>.chtml for Content item templates
  3. Enter the content of the templates and save the file.
  4. Login to Sitefinity CMS backend as Administrator
  5. Navigate to Administration » Settings » Global settings » Mobile formats
  6. Select your content type.
  7. In the corresponding dropdown box, select your template.
  8. Click Done.

Was this article helpful?