Site Initializers: Update Support

How to enable "update" support for Site Initializers


Several months ago I wrote an article about Site Initializers (read if you missed it 😉). It describes how to setup content using Bundle Site Initializer. And it also highlights (in article itself and in comments) that the main issue with Site Initializers was missing "update" support: if any changes to content required - site should be re-created from the initializer each time. We used Site Initializer on a project with lots of content: things were simplified a bit due to the same content in each environment, but site re-creation process was really annoying.

I've been searching for a solution for a while, submitted a ticket on Liferay Issues, and even started an own implementation (including update support with different strategies, additional content types and custom extensions points).  

But recently I've found that update support is already there in Liferay! (Perhaps, Liferay Team was inspired by my blog and Jira requests - feature was implemented 2 months after my submissions 😊) This feature is not enabled by default, but can be easily switched on.

How to enable update support

Update Support for Site Initializers was implemented in scope of LPS-165482, but it's still hidden under Feature Flags. This feature can be enabled in the following ways:

1. Using portal properties

Add the following property to


and restart server.

2. Using UI (starting from 7.4 GA 69)

Navigate to Control Panel → Instance Settings →Platform → Feature Flags:

and enable LPS-165482 feature under Developer tab:


How does it work

If feature flag is enabled - an additional property siteInitializerKey is save to site group's typeSettings (see BundleSiteInitializer#_updateGroupSiteInitializerKey). This links the created site with its initializer. If there are any changes in initializers's code - changes can be synced using SiteInitializerPortlet, which is rendered as a panel app under Publishing category (only if feature flag is enabled and site initializer matching siteInitializerKey is registered, see SiteInitializerPanelApp#isShow).  

Example in Action

As an example - let's create a custom bundle based on Masterclass initializer.


Bundle-Name: Liferay Site Initializer Masterclass Demo
Bundle-Version: 1.0.0
Liferay-Site-Initializer-Name: Masterclass Demo
Web-ContextPath: /site-initializer-masterclass-demo

Resources for site initialization can be copied from the original "Masterclass" initializer (I included only one layout to simplify the deployment). 

Deploy module and create a new site from the deployed initializer:

The following site should be created:

Now let's modify the content definition in the initializer's module - for example, define custom editable values for the fragment fields on the home page:

and re-deploy the initializer module.

Then navigate to the Site Initializer item under Publication menu, and click the Synchronize button:

Once synchronized - changes should be available on the site: 


Leave your comments and feedback.

Stand with Ukraine 

Enjoy 😉


Vitaliy Koshelenko

Liferay Architect at Aimprosoft


With a site-initializer, is it possible to synchronize the default 'Guest' site?

By default - no, site should have a "siteInitializerKey" property in typeSettings. 

But if we deploy a site initializer module, and update site's typeSettings (e.g. with an Upgrade Process or via Groovy scripting console) - should be possible, I guess.