What is content fragments?
Content fragment has been introduced in AEM6.2. It allow us to create, design and page independent content. It’s store as an Asset so, it is managing through Asset console. It’s allow to use in multiple location or channels eg: mobile site, desktop site etc. Content Fragments do not contain any layout and design. Content fragments are not available in the classic UI.
Since AEM6.4 it can deliver in JSON format, using Sling Model export capabilities in AEM core components. AEM Content Fragments can be used to describe and manage structured content. Structured content is defined in models that can contain a variety of content types; including text, numerical data, boolean, date and time, and more. Learn more about content fragment.
Types of Content Fragments
Content fragments are available in two types.
- Simple fragments
- It does not have customized structure, It contains only text and images.
- Fragment contains structure contents
- Based on content fragment model. we can customize the structure.
Variation
Variations are copy of master content fragment and can be edit the content inside variation. It is using for specific channel and authoring as per requirement. eg: Mobile site variation or email variation.
Create a content fragment
To create a content fragment perform below steps:
- Go to AEM Start> Assets > Files
- Or click to open AEM asset view http://localhost:4502/assets.html/content/dam
- Create a folder “Demo Folder”
4. Now inside the “Demo Folder” create content fragment
5. Select the “Simple Fragment” template and click the Next.
6. Specify “Demo content fragment” as the title and “Example of content fragment” as the description and click create.
Edit text in content fragment
Select Demo content fragment and click edit the fragment. Then add text inside the fragment and click save.
Create a variation
We can create multiple variations of channel specific which will use in different AEM application.
Let see how to create variation. There are few steps:
- Click on create variation in left and provide name for variation. eg: Mobile view
- Now add text content specific to mobile view and click save.