How to Create a Content Fragment in AEM.
Simplified step by step instructions to create Content Fragment.
Content Fragments are editorial content without any experience. Which can be reused on multiple pages. To create a content fragment we require a content fragment model. The content fragment model defines the structure of content. Once the Content fragment Model is created it can be used to create content fragments for data sets. It is implemented as a dam:Asset. The content fragment can be used in AEM pages using the content fragment component or you can also use it as Raw JSON for 3rd party applications.
Step1: First of all we have to create a model for our content fragment. In this step, we are going to create a model for doctor info.
Go to Tools -> Assets ->Content Fragment models.
Step2: Open your folder and select create option.
Give a title to your CF model and make sure that enable model checkbox is checked. You can keep the rest of the fields as it is.
Step 3: Open your created CF Model and now drag and drop different data type fields given in the right pane as per your requirements.
you can also edit properties like field label, property name etc.
Once you are done then select save.
great work !!! your CF Model is now ready for further use.
Step 4: Now in this step we will configure our CF Model path in the properties of the content fragment folder.
Go to Navigation ->Assets and then select Files.
select your folder and go to properties.
Step 5: now go to the Cloud Services tab then under Cloud Configuration select our CF Model folder and select Save & Close.
Step 6: Now we will create different content fragments for each doctor. Select your folder and click on Create option then select Content Fragment.
then you will see all the models you created under your CF Model folder here. Select your model and click Next.
Give your content fragment a name, description (optional), and tags (optional). Then select Create.
Step 7: Select your content fragment and edit it. Now you can see all the fields you added during the creation of the CF Model. Now Author all the values and click save.
Repeat Step 6 for other content also and create your content fragments.
Congrats!!! Now you know how to create a content fragment.
If you want to create a separate folder for your content fragment models then follow the below steps.
Step 8: Go to Tools -> General -> Configuration Browser.
Select create option.
Step 9: Give a title to your configuration and check the content fragment models checkbox.
Now your configuration is ready to use, Go to Step 2 and follow the rest of the steps.
Did you like my efforts? If Yes, please follow me to get my latest posts and don’t forget to show your love ❤️ by clapping 👏 for this article and let me know your views 💬 in the comments section.