March 22, 2020
Estimated Post Reading Time ~ 1 mins

Create & Author Content Fragments in AEM

Log in to AEM, go to Assets > Files.
Let us create a folder now called 'My Samples' by clicking the create button.
Create+CF+Folder
Now go inside the folder and click on create > Content Fragment.

Then Select the Simple Fragment template. Enter title and description and then click on create.
Create+CF

In the next dialog click on open and edit content fragment as shown below.
Author+CF

To access the content fragment, we need to author it on a page. Let us author it on a sample we-retail page.

Now go to sites> we-retail > us >en > Men, open it for editing.

From the component browser, drag and drop the 'Content Fragment' component on the page.
Author+CF+2

Click on Configure and add the newly created Content Fragment and save it.
Authoring+and+landing

We have the authored Content Fragment now. We can access it over the JSON Exporter API by invoking the '.model.json' in the author instance, For me, it was below URL.

http://localhost:4502/content/we-retail/us/en/men/jcr:content/root/responsivegrid/contentfragment.model.json

Note: This URL needs to be updated in file "retrieve_content_fragment.js" at line '$("button").click(function(){ $.ajax({url:'

The sample output is given below.
AEM+6.4+Content+Fragment+Output
Now Publish the page where Content Fragment is authored. So that all data is available in AEM Publish

aem4beginner.blogspot


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.

Ad Blocker Detected :(

Please consider supporting us by disabling your ad blocker.

Please Disable your adblocker and Refresh the page to view the site content.