Introduction
In Liferay, Page templates provide a predefined page structure that can be used when creating new pages. It is useful for consistency while allowing some customizations per page.
Why are they useful?
Helps quickly create new pages with a consistent structure.
Can be modified at the individual page level after creation.
Reduces manual effort in setting up similar pages.
When to Use Page Templates
On many websites, some pages share a similar layout, with only the content differing. You can create a Page Template for consistency across similar pages and save time in these cases.
Instead of adding common elements on each page from scratch, you can create a Page Template once and reuse it whenever needed.
Creating a Page Template
We will first create a page template for the reusable layout, and then apply it while creating the same structure pages.
Navigate to Site Menu > Design > Page Templates > Page Templates (the second tab).

Click on Create New Page Template. You’ll be prompted to choose between :
Content Page Template : Allows you to add both fragments and widgets.
Widget Page Template : Allows you to add only widgets.
Note : If you have created and set common components(header and footer) in a Master Page, you can select the master page here so you don’t need to add these common components manually each time.
For this example, select the Content Page Template since we need to include fragments.
Enter a name for your page template.

Once the page template is created, you can add widgets or fragments that will be used commonly across similar structure pages.
In this example, we have added two editable fragment fields : Banner and Services, which can be reused on multiple similar pages.

Click Publish to save your page template.
Applying a Page Template
Using the page template, we will create one page.
Navigate to the Site Builder > Pages > Create New Page.
You will have a list of available page templates. You need to select the one you have created.
For example : Demo Page Template.
Define a name for this new page.

Now, the page will automatically load Banner and Services fragments already added, as they are part of the page template.

You can do customization for these fragments according to the specific content of the page, and then publish the page.
You can create some more pages that have the same layout, only the content difference is there.
Updating Page Templates
After the page template creation, sometimes you need to update a page template to reflect some new changes or add common elements.
For existing page template updation :
- Navigate to the page template you want to update and edit the template.
- Add some changes in the layout, fragments, or widgets as needed.
- You can add new fragments.
- Remove or rearrange existing components.
- Update default content or styling.
- Click Publish after making changes.
Note : Changes made to a page template do not automatically apply to pages that were already created using the template. Those pages are independent once created, so if you want the changes reflected, you will need to manually edit each page or recreate them using the updated template.
Updating a page template is useful when you want to maintain a consistent look and feel across your site and streamline the creation of new pages with a predefined structure.
Conclusion
Page Templates in Liferay are a useful way to ensure consistency, save time, and streamline page creation for pages that share a similar layout. It helps to maintain a clean structure and reduce repetitive work.