Rendition is missing in new Content Fragment Model | Community
Skip to main content
Level 3
October 18, 2021
Solved

Rendition is missing in new Content Fragment Model

  • October 18, 2021
  • 4 replies
  • 2614 views

Previously, we used a Simple content fragment model(OOTB) to create CF and reading programmatically using the Original rendition created under each file. The 6.5.10 simple fragment model is deprecated, so we created a new Content fragment model that does not create renditions.

 

Is anyone know why it is not creating any renditions under file with the new Content fragment model?

 

With Simple fragment Model it is creating rendition -




With New custom content fragment model --

 



This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kishore_Kumar_

Hi @ramaem12 ,

 

I am not sure on the renditions difference between two but i guess if you use Content Fragment API you just need a CF path to get its "Original" data.

 

//Get the resource of content fragment as below.
Resource fragmentResource = resourceResolver.getResource(“/content/dam/fragments/my-test-fragment”);

//Adapt it to a fragment resource
if (fragmentResource != null) {
ContentFragment fragment = fragmentResource.adaptTo(ContentFragment.class);
 Iterator<ContentElement> elements = fragment.getElements();
while (elements.hasNext()){
ContentElement element = elements.next();
} }

https://aemdeveloper.wordpress.com/2017/08/22/create-access-the-content-fragment-programmatically/

 

4 replies

Kishore_Kumar_
Kishore_Kumar_Accepted solution
Level 9
October 18, 2021

Hi @ramaem12 ,

 

I am not sure on the renditions difference between two but i guess if you use Content Fragment API you just need a CF path to get its "Original" data.

 

//Get the resource of content fragment as below.
Resource fragmentResource = resourceResolver.getResource(“/content/dam/fragments/my-test-fragment”);

//Adapt it to a fragment resource
if (fragmentResource != null) {
ContentFragment fragment = fragmentResource.adaptTo(ContentFragment.class);
 Iterator<ContentElement> elements = fragment.getElements();
while (elements.hasNext()){
ContentElement element = elements.next();
} }

https://aemdeveloper.wordpress.com/2017/08/22/create-access-the-content-fragment-programmatically/

 

Sanjay_Bangar
Community Advisor
Community Advisor
October 18, 2021

Hi @ramaem12 ,

                           Yes, Can you please try on Vanilla instance  and if issue still persist then raise issue to the concerned team.

 

Regards,

Sanjay

Ankur_Khare
Community Advisor
Community Advisor
October 18, 2021

Hi,

When you are creating the content fragment could you please check the logs and let us know whats coming there.

Community Advisor
October 18, 2021

The content is stored under data node in latest AEM versions(not sure from which version), refer to the below image. The rendition folder is empty but the variations and the content is stored under data node

 

 

 

I was using specific logic to handle this - https://github.com/adobe/aem-core-wcm-components/blob/master/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/ContentFragmentUtils.java (Just for your info) but as @kishore_kumar_  mentioned use the Content Fragment API to fetch the content.

Regards

Albin I

www.albinsblog.com

November 29, 2022

As @albinis1 mentioned, Latest version of AEM ( Ex: 6.5.13/14) CF data will be stored under cf/jcr:content/data/master node and variations are under cf/jcr:content/data/cf1(variations)

 

To get CF propeties: 

OOTB Content Fragment API will help to get all properties of CF which store under master node

//Get the resource of content fragment as below.
Resource fragmentResource = resourceResolver.getResource(“/content/dam/fragments/my-test-fragment”);

//Adapt it to a fragment resource
if (fragmentResource != null) {
ContentFragment fragment = fragmentResource.adaptTo(ContentFragment.class);
 Iterator<ContentElement> elements = fragment.getElements();
while (elements.hasNext()){
ContentElement element = elements.next();
} }

 

To get Image renditions:
- Observed that latest version of AEM CF renditions are not storing.
- For testing purpose, added some image renditions manually in CF reditions folder. if we want to get those renditions  by using CF API. have to loop rever (need to read parent from the child then loop the condition to get renditions node).

Note : recursiveness and it will not be generic approach. 

November 30, 2022