How To Integrate Page Templates In Agility CMS | Agility CMS Docs

Page Templates

Page Templates in Agility represents a page's layout. This enables a variety of layouts where editors can add Page Modules to one or more Content Zones.

When editors create pages in Agility CMS, they must select which template they'd like to use from a list of pre-defined Templates which you, the developer, have created for them.

As a developer, you can decide how the template is rendered into HTML.

Each template has Content Zones which are areas where editors can enter pieces of content. These are called Page Modules, and they can be added, removed, and rearranged within these zones to structure a page.

For example, you may have a simple Page Template named Main Template that is used for your Home or About Page with a single Content Zone.

Main Template in Agility CMS

You might also have a more complex Page Template called Two Column Template that has two Content Zones, a Main Content Zone, and a Sidebar Content Zone which can be used for a News or Blog Listing Page.

The bulk of the Content and Page Modules on the page can reside within the Main Content Zone, and the Sidebar Content Zone can contain a Page Module that displays The Latest, or Related Posts or News Articles.

How to Create Page Templates

1. Navigate to page templates by clicking on Models > Page Templates

Creating page templates in Agility CMS

2. Click on Add.

Each page template has the following items:

  • Name - The name of the Page Template.
  • Content Zone(s) - Areas that are defined in the Page Template by the developer where you can add/delete modules and organize your page structure.

3. Enter the Name of the Page Template.

Enter name of page template in Agility CMS

4. Add Content Zones by clicking + button.

Add content zones for page templates in Agility CMS

5. Fill in Display Name (this will automatically populate the Reference Name) and if desired add Default Modules that will be automatically added to the page template by clicking the + button.

Module zone details for page templates in Agility CMS

A shared module zone is when you specify a content zone that it will be shared across all pages that use the same template. For example, if you had a sidebar content zone and you want the content to be the same across multiple pages.

Now you can see your newly created Page Template in the list.

Page template list in Agility CMS

Next Steps

Editors can start to use your Page Template when they create new pages. Editors may also migrate an existing page to use the new Page Template and copy over any Page Modules they want to keep.

Rendering the Page Template

In order to handle the rendering for the new Page Template in your solution, you'll need to have code that will be responsible for rendering the template.

Setting Default Modules on a Page Template

If you have a case where editors consistently build pages with similar layouts, you can set up Default Modules that are associated with each Content Zone on the Page Template.

Content zone details in Agility CMS

When editors create a page using that template, they'll immediately see the Page Modules that are associated with the template that they need to enter content for.

Page modules associates with templates in Agility CMS