Friday 14 December 2018

Create & Author Content Fragments in AEM

Previous post on this topic
How to create & Deploy a Progressive Web Application


Login to AEM, go to Assets > Files.
Let us create a folder now called 'My Samples' by clicking the create button.
Create CF Folder - click on it to see it big

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 Content Fragment AEM


In 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 component browser, drag and drop 'Content Fragment' component on the page.

[Author Content Fragment AEM 6.2 onwards


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 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

Demo


Next post:
Integrate PWA & AEM and retrieve the AEM content from PWA.

No comments:

Post a Comment