Content Fragments in AEM part-1



Content Fragments allow us to create design and publish the page independent content. The Content fragment are basically can be text and images, which can be editable, Content fragment are pure content and that don’t have any styling and layout which means Content Fragments can be without layout and style. Content fragments allow us to create channel neutral content along with channel specific variation. We can have a same content for different devices or channels like mobile tablet and desktop, The Content fragment component it is responsible to display the content of the Content fragment and we can use the content fragment and their variation while altering the page .

AEM came with it’s default content fragment which means out of the box content fragment component but we can also create our custom content fragment content fragment can also be exported as Jakson format using the sling model Json export capabilities.

Content Fragment is the part of Assets so stored in DAM in assets form.
Adobe Experience Manager is designed in the way so that every thing can be manage and maintained easily.
The content is export as json form using content fragment. So we can use it in restful API’s. which can be handled easily.

Content Fragment Architecture-

Below is the Content Fragment architecture diagram, so you can understand overall architecture of Content Fragment in a glance.

Content fragment architecture

Create Content Fragment Model

So let’s make our Content Fragment model folder-

Go to the Tools>Assets> content Fragment model if you are not able to see any create button to create Content Fragment folder or don’t see any folder relevant to your project then you don’t have sufficient permission for creating the content fragment model folder. In that case just follow the below steps-

Go to the tools>configuration Browsers> select your project specific folder and click on properties.

If you are able to see the folder in Content Fragment Model, then click on the folder which has the same name of your project.

Then create a content fragment model I have created the Author Content Fragment Model having some fields as Author Name, Profession, Checkbox is author Dropdown having the professions value like Professor, Student, author etc., and date field, and one Author bio with Rich Text editor so we can have more options, and all your content fragment model is stored under /conf folder- go to crxde/conf/myprojectfolder/settings/dam/Content fragment model /models you will see your Content fragment model.



I’m suppose we have a different page, and we need to publish the content on those pages what we had to do we use different. First create the Content Fragment Model as below.

Create Content Fragment and use that on page steps are below-

Go to the tools>assets>dam>myproject folder>create >language folder then creates Content fragment using the content fragment model we have created as “Author” in  the steps.





 

Author all fields for author Content fragment and then create a proxy component from crxde by copy the path of the core content Fragment path.

(core/wcm/components/contentfragment/v1/contentfragment), we should not copy the core Content fragment component because if in future if there is any updation that come then we have to change our all code accordingly f we are using the path as resourceSuperType then updation will come automatically. After that remove/delete the default component’s jsp file so it can utilize core one.

Now there is one more point that people worried about where are the content fragment models stored in aem? The content fragment models stored under the /conf folder

as /conf/projectname/settings/dam/cfm/models