How to replicate changes on master pages?

“I have more than 30 pages already created that use Liferay’s default master page, and I needed to create a new one. Is there an option to make this change replicate to all of them automatically?”

Question came through Slack. Posted for a Community member in Brazil.

Hello, everyone. This topic piqued my curiosity, so I decided to create a JSP portal to help us address this gap. https://github.com/wesleyroberts/master_page_tool

2 Answers

2

Hello, everyone. This topic piqued my curiosity, so I decided to create a JSP portal to help us address this gap.

This module contains a JSP portlet for bulk Master Page administration in Liferay.

The goal of the portlet is to allow the user to:

  • view the Master Pages available in the site

  • select multiple pages through checkboxes

  • apply a Master Page in bulk to the selected pages

This project setup was built for:

  • dxp-2026.q1.7-lts

Because of that, this branch already follows the newer platform changes related to the migration from javax to jakarta, including updated APIs and imports such as jakarta.portlet.*.

There will be another branch in this repository focused on Liferay 2025 portal versions, which still use javax.

https://github.com/wesleyroberts/master_page_tool

Hello @AnneDurey,

Currently, there is no out-of-the-box method available for bulk updating the master page template for existing pages. However, this can be achieved through a custom script using this service: liferay-portal/portal-kernel/src/com/liferay/portal/kernel/service/LayoutLocalServiceUtil.java at master · liferay/liferay-portal · GitHub

Cheers!

Hi @Anne_Durey I created this groovy script for this scenario recently: https://github.com/michael-wall/groovy-scripts/tree/master/setMasterPageTemplate