Using Experience Fragments
This page covers the following topics:
- Using Experience Fragments in AEM Screens
- Propagating Changes from the Master Page
Experience Fragment An is a group of one or more components including content and layout that can be referenced within pages. Experience fragments can contain any component, such as, one or multiple components that can contain anything within a paragraph system, that will be referenced into the complete experience or requested by a third endpoint.
Using Experience Fragments in AEM Screens
The following example uses We.Retail as a demo project from where the Experience Fragment is leveraged from a Sites page to an AEM Screens project.
As an example, the following workflow demonstrates the use of experience fragments from We.Retail in Sites. You can choose a web page and leverage that content in your AEM Screens channel in one of your projects.
Creating a Demo Project with a Channel
Creating a Project
- Click Create Screens Project to create a new project.
- Enter the Title as DemoProject.
- Click Save .
A DemoProject will be added to your AEM Screens.
- Navigate to the DemoProject you created and select the Channels folder.
- Click Create from the action bar to open the wizard.
- Choose the Sequence Channel template from the wizard and click Next .
- Enter the Title as TestChannel and click Create .
Creating an Experience Fragment
Follow the steps below to leverage the content from We.Retail to your TestChannel in DemoProject .
- Navigate to a Sites page in We.Retail
- Navigate to Sites and select We.Retail In-Store -> United States -> English and select Equipment page to use this as an experience fragment for your Screens channel.
- Click Edit from the action bar to open the page you want to use as an experience fragment for your Screens channel.
- Re-using the Content
- Select the fragment you want to include in your channel.
- Click the last icon from the right to open the Convert to experience fragment dialog box.
- Creating Experience fragment
- Choose the Action as Create a new Experience Fragment .
- Select the Parent path .
- Select the Template . Choose the Experience Fragment - Screens Variation template here.
- Enter the Fragment Title as ScreensFragment .
- Click the check mark to complete the creation of a new experience fragment.
- Creating Live Copy of Experience Fragment
c. Select the** ScreensFragment** from Create Live Copy wizard and click Next.d. Enter the Title and Name as Screens.e. Click Create to create the Live Copy.f. Click Done to move back to ScreensFragment page.Once you have created Screens fragment, you can edit the properties of your fragment. Select the fragment and click Properties from the action bar.Editing Properties of a Screens Fragment
- Navigate to the AEM home page.
- Select Experience Fragments and highlight the ScreensFragment and click Variation as live-copy , as shown in the figure below:
You can add the Client-side Libraries (java and css) and Static Files to your experience fragment.The following example shows the addition of client-side libraries and the fonts as a part of static files to your experience fragment.
- Navigate to the ScreensFragment (you created in the preceding steps) and click Properties from the action bar.
- Select the Offline Config tab, as shown in the figure below.
- Using Experience Fragment as a Component in Screens Channel
e. Select the Experience Fragment component and select the top left (wrench) icon to open the Experience Fragment dialog box.f. Select the Screens live copy of the fragment you created in Step 3 in Path.f. Select the Screens live copy of the fragment you created in Step 3 in the Experience Fragment.h. Enter the milliseconds in Duration .i. Select the Offline Config from the Experience Fragments dialog box to define the client-side libraries and the static files.If you want to add client-side libraries or the static files in addition to what you configured in step (4), you can add from the Offline Config tab in the Experience Fragment dialog box.j. Click the check mark to complete the process.
- Navigate to the Screens channel where you want to use the Screens fragment.
- Select the TestChannel and click Edit from the action bar.
- Click the components icon from the side tab.
- Drag and drop the Experience Fragment to your channel.
Validating the Result
After completion of preceding steps, you can validate your experience fragment in ChannelOne by:
- Navigating to the TestChannel .
- Selecting the Preview from the action bar.
You will view the content from the Sites page (live-copy of the experience fragment) in your channel, as shown in the figure below:
Propagating Changes from the Master Page
Live Copy refers to the copy (of the source), maintained by synchronization actions as defined by the rollout configurations.
Since the Experience Fragment, we created is a live copy from the Sites pages, so if you make changes to that particular fragment from the master page, you will view the changes in your channel or the destination where you have used the Experience Fragment.
For more information on Live Copy, see Reusing Content: Multi Site Manager and Live Copy.
Follow the steps below to propagate changes from the Master channel to your destination channel:
- Select the Experience Fragment from the Sites (Master) page and click the pencil icon to edit the items in the Experience Fragment.
- Select the Experience Fragment and click the wrench icon to open the dialog box to edit the images.
- The Product Grid dialog box opens.
- You can edit any of the images. For example, here the first image is replaced in this fragment.
- Select the Experience Fragment and click the Rollout icon to propagate changes to the fragment that is used in your channel.
- Click Rollout to confirm the changes.You will see that the changes are rolled out.
Validating the Changes
Follow the steps below to confirm the changes in your channel:
- Navigate to the Screens -> Channels -> TestChannel .
- Click Preview from the action bar to confirm the changes.
The following image illustrates the changes in your TestChannel :