Creating and Managing Element Variations
Beta Feature Liferay DXP 2026.Q3+
An element variation changes one element of a content page for a specific audience, instead of duplicating the whole page into a separate experience. Variations can replace the element’s inner HTML, run JavaScript against the element, or hide the element. Variations are applied in the browser, on top of the experience Liferay DXP renders for the visitor.
Replacing an element’s inner HTML or running JavaScript against it requires custom markup or code. Hiding the element does not.
Prerequisites
Using element variations has these requirements:
-
The
LPD-85746feature flag is enabled. -
At least one audience exists.
A variation can target only an editable fragment element on a content page. Elements that carry no editable ID, including widgets and containers, do not appear in the Page Element picker.
Creating an Element Variation
-
Open the Site Menu (
) and go to Site Builder → Pages. -
Click Actions for a content page and select Edit.
-
In the page editor toolbar, click Create Variations next to the experience selector.

The element variations editor opens, with a sidebar on the left and a preview of the page on the right.
-
Use the Experience selector at the top of the sidebar to choose the experience the variation belongs to.
-
Click New.
-
Enter a name for the variation.
-
Select an element in the Page Element picker.
Each option is labeled with the fragment name and the ID of the editable element inside it, such as
Banner (title). Hovering over an option highlights that element in the preview.
When the element you want is missing from the list, it most likely does not have the
data-lfr-editable-idattribute. See Fragment Specific Tags and Attributes Reference for more information on making fragment elements editable. -
Select one or more audiences in the Audience field.
An audience already used by another variation of the same page element does not appear.
-
(Optional) Toggle Hide Page Element to hide it from the set audiences.
TipThe preview automatically updates as you make edits, so you can see the result of your changes.
-
(Optional) Enter custom markup into the HTML field.
The markup replaces the element’s inner HTML.
-
(Optional) Enter custom code in the JavaScript field to run it against the element.
The code runs after the HTML replacement and can use a variable named
element, which holds the target element.ImportantOnce the code has run, its effects stay applied to the preview even as you keep editing. Click Reload to load the preview again and run the current code from a clean page.
-
Click Save.
Saving stores the variation on the page’s draft.
-
Publish the page.
Visitors see element variations only after the page is published. Publishing matches each variation to the experience it belongs to. Because detection runs in the browser after the page loads, visitors may briefly see the default content before a variation is applied.
Managing Existing Variations
The sidebar lists the variations of the selected experience, grouped under the page element each one targets. Every entry shows its name, its audiences, and a label for each part it defines: HTML, JavaScript, or Hide Element. A variation that is turned off also shows a Disabled label.