


Hi,
I am trying to create a content fragment using com.adobe.cq.dam.cfm.ContentFragmentManager create method. I tried giving different content fragment model resources at create(Resource parent, Resource template, String name, String title). It always giving com.adobe.cq.dam.cfm.impl.InvalidTemplateException: Invalid template format; missing 'version' attribute.
Am I missing anything here?
@Reference
ContentFragmentManager cfm;
--
Resource parent = resourceResolver().getResource("/content/dam/fragments");
Resource template = resourceResolver().getResource("/conf/global/settings/dam/cfm/models/custommodel");// content fragment model in my local
ContentFragment contentFragment = cfm.create(parent, template, "samplefragmentname", "sample fragment title");
resourceResolver().commit();
Thanks,
Raja
Solved! Go to Solution.
Views
Replies
Sign in to like this content
Total Likes
CF Model is not same as CF Template. That's the issue in this case. Either you create a CF template or use an existing editable template for the same. Create a CF manually and you'd get to know more about it.
Resource template = resourceResolver().getResource("/conf/global/settings/dam/cfm/models/custommodel"); // provide template path rather than CF model path
Refer - Content Fragment Templates
Views
Replies
Sign in to like this content
Total Likes
CF Model is not same as CF Template. That's the issue in this case. Either you create a CF template or use an existing editable template for the same. Create a CF manually and you'd get to know more about it.
Resource template = resourceResolver().getResource("/conf/global/settings/dam/cfm/models/custommodel"); // provide template path rather than CF model path
Refer - Content Fragment Templates
Views
Replies
Sign in to like this content
Total Likes
I tried with template. It is working. Thanks Gaurav!
Thanks,
Raja
Views
Replies
Sign in to like this content
Total Likes
Can you please share the template path you used?
Views
Replies
Sign in to like this content
Total Likes
I used OOB simple template
/libs/settings/dam/cfm/templates/simple/jcr:content
Views
Replies
Sign in to like this content
Total Likes