How to display Content Fragments in UI.?

Avatar

Avatar

imadullakhan

Avatar

imadullakhan

imadullakhan

28-05-2020

Hi @All,

 

I have couple of Content Fragments which i need to show in UI. How to do this one. Can any one help me please? 

View Entire Topic

Avatar

Avatar

BrianKasingli

MVP

Avatar

BrianKasingli

MVP

BrianKasingli
MVP

29-05-2020

@imadullakhan 

For content authoring, you can simply go to dam assets, and edit the content fragment; here you can edit content based on how your content fragment schema is setup.https://docs.adobe.com/content/help/en/experience-manager-64/developing/extending-aem/customizing-co...
To display content from the content fragment you can have several methods, but these are the popular methods that I've used in the past:

  1. Use the WCM Core Components, content fragment component https://docs.adobe.com/content/help/en/experience-manager-core-components/using/components/content-f...; there are some limitations, so you might need to extend the component as per your requirements. 
  2. Create your own component that consumes the content fragment. use the Granite UI, pathfield, to point to your content fragment, then using backend logic to expose properties to slightly via Sling Models.

API: When you want to expose Json to 3rd party services, you can utilise the WCM Core Component V2 Page, and also the WCM Core Component content fragment component, you can call model.json on the page, and see the basic structure of the content fragment values presented as the JSON response.

I hope this helps.