Managing Fragments
Liferay DXP provides tools for managing fragments in the Liferay UI. With out-of-the-box tools, you can edit fragment code, export/import fragment sets between sites, and more.
To share fragments and sets between sites, add them to the Global site or use the export/import actions.
You can use the Export/Import actions within the fragment sets and individual page fragments if you have a ZIP file. Alternatively, if you have a LAR file, you can use the Export/Import options in the Options menu located at the Applications Bar.
Managing Fragment Sets
-
Open the Site Menu () and go to Design → Fragments.
-
Select the desired fragment set.
-
Click Actions () for the fragment set you want and select an action:
Edit: Change the name or description for the fragment set.
Export: Download the fragment set as a
.zip
file. This file includes the set’s.json
, fragment code, and resources.Import: Upload fragments and resources to a set as a
.zip
file. If an imported fragment has invalid rules, it is saved as a draft. This import process works similarly to the page template import process.Delete: Remove the current fragment set and all its contents.
To export multiple sets, click Actions () for the fragment set you want to export and select Export. Then, check the sets you want to export and click Export. Each set is downloaded as a separate .zip
file.
To export fragments in Liferay PaaS, use the appropriate JVM settings.
Managing Individual Page Fragments
-
Open the Site Menu () and go to Design → Fragments.
-
Select the desired fragment set.
-
Click Actions () for the fragment you want and select an action:
Edit: Modify the fragment’s code or configuration.
Change Thumbnail: Change the fragment’s thumbnail image.
Remove Thumbnail: Remove the fragment’s thumbnail image and use the default fragment type icon.
Rename: Change the fragment’s name.
Mark or Unmark as Cacheable: Mark or unmark the fragment as cacheable. When a fragment is cached, it improves the performance of its pages.
WarningDefault fragments like
HTML
are cached by design, and their cacheable setting cannot be changed. Marking a fragment as cacheable improves page performance but delays updates to mapped assets. Changes are only visible after republishing the page or manually clearing the cache.If immediate updates are essential, use uncached fragments or create custom fragments with tailored caching settings.
View Usages: View the pages where the fragment is used. You can see the page’s name, type, version, and the time since the page’s last propagation. You can also select a page and propagate it.
Export: Download the fragment as a
.zip
file.Make a Copy: Duplicate the fragment. Duplicated fragments share the same name with (Copy) appended to the end.
Move: Move the fragment to a different fragment set.
Delete: Remove the fragment.
ImportantUsers cannot edit or copy saved fragment compositions.
Copying Fragments
For Liferay DXP 7.2 SP1+ and Liferay Portal 7.2 GA2+
-
Open the Site Menu () and go to Design → Fragments.
-
Select the desired fragment set.
-
Click Actions () for the fragment you want and select Copy To.
-
Select the set where you want to copy the fragment.
Users cannot edit default fragments directly. However, you can copy default fragments into a custom set and edit them there.