Staging a Site that References Another Site

There may be instances when a Site that is being staged (e.g. Site A) has references to content that was created in another Site (e.g.Site B).

This article describes what is happening to the content that is not stored in Site A directly, but is actually stored in Site B, and we use Staging on the content in Site A.

After all, if we are only Staging Site A and not Site B, how do those references get carried over? Since Liferay Portal uses the same export/import framework for Remote Staging, Local Staging, and Export/Import, we need to make sure that we don't become vulnerable to dependency issues. In other words, if we have a Site that has these kind of references to other Sites, we need to handle it in a way so that we can stage the content consistently.

Here is an example scenario to illustrate a use-case in which one might reference content from another Site.

  1. Single Web Content Article of Dessert Items is created.
  2. Multiple Sites for different Restaurants are created.
  3. User would like to create a Web Content Display portlet and reference the Web Content Article for Dessert Items created in one of the Restaurants Sites, instead of creating a copy in each Site.

Should the Dessert Items article just exist in ONE of these Restaurant Sites? After all, you can just create Web Content Display portlets on the other Restaurants Sites and scope those portlets to display the Dessert Items content created in the other Site.


If you do not plan to use Staging on your Sites, then the answer is "Yes", you can go ahead and create the Web Content Article in one of the Sites and reference the Article in other Sites without storing a copy of it on each of the Sites.

If you are planning to use Staging to carry over the Sites into a different environment, you should be aware that Staging each of those Sites which are referencing the "Dessert Items", will result in copies of the "Dessert Items" on each of the Sites staged to. In other words, if you have 4 Sites (1 where the "Dessert Items" content is stored and 3 Sites that are referencing this content) and you stage all 4 Sites, the 4 Live Sites (or the Sites that are receiving the imported/staged content) will now each have a copy of the "Dessert Items" content. Obviously in case there are a lot of cross Site references, the result may affect performance badly. For this reason the Global Site has been implemented, which exists for every server. However, the Global Site's usage is a bit different in Liferay 6.1 than Liferay 6.2:

  1. In Liferay Portal 6.1—When you start a publish process, Liferay will check to see if there is content stored in the Global Site or if it exists in the Site we are publishing to, and if it does not find it in either scope, it will add the content to the target Site. This means that in our previous example the "Dessert Items" article will be created 4 times, once on each Site. Therefore to avoid having the same content duplicated across multiple Sites when Staging, you should store content in the Global Site, and reference the Article from your other Sites. With this approach Liferay will create the article on the Global Site and will not make a copy of that content on the Site you are publishing to.
  2. In Liferay Portal 6.2—The process will also check if the content is referenced from the Global Site, but if it cannot find the referenced article in the Remote Server's Global Site, it won't create the content on the target Site, the process will stop instead and display a missing reference error message. This restriction was implemented to ensure that the articles and references are the same on both environments. This means that you should still store the content in the Global Site, and reference the Article from your other Sites to avoid having the same content duplicated, but before publishing these Sites, you should export/import or stage the content from the Staging Server's Global Site to the Remote Server's Global Site in order to have a successful publish.

In summary, if a you want to reference content from outside its scope and you are using staging for the related portlet, you should put the content in the Global scope, and in case of Liferay 6.2, you should move the content to the Live Server before publishing the actual Site.

Additional Information

Was this article helpful?
0 out of 0 found this helpful