Content Fragments Configuring Components for Rendering
- Topics:
- Content Fragments
CREATED FOR:
- Developer
There are several advanced services related to the rendering of content fragments. To use these services, the resource types of such components must make themselves known to the content fragments framework.
This is done by configuring the OSGi Service - Content Fragment Component Configuration.
Definition of Advanced Services that need Configuration
The services that require the registration of a component are:
- Determining dependencies correctly during publication (that is, ensure that fragments & models can be automatically published with a page if they have changed since last publication).
- Support for content fragments in full text search.
- The management/handling of in-between content.
- The management/handling of mixed media assets.
- Dispatcher flush for referenced fragments (if a page containing a fragment is re-published).
- Using paragraph-based rendering.
If you need one or more of these features, then (typically) it is easier to use the out-of-the-box functionality, instead of developing it from scratch.
OSGi Service - Content Fragment Component Configuration
The configuration needs to be bound to the OSGi service Content Fragment Component Configuration:
com.adobe.cq.dam.cfm.impl.component.ComponentConfigImpl
For example:
The OSGi configuration is:
dam.cfm.component.resourceType
The resource type to register; for example,
core/wcm/components/contentfragment/v1/contentfragment
dam.cfm.component.fileReferenceProp
fragmentPath
or fileReference
dam.cfm.component.elementsProp
elementName
dam.cfm.component.variationProp
variationName
For some functionality (for example, to render only a paragraph range) you will have to adhere to some conventions:
paragraphRange
A string property that defines the range of paragraphs to be output if in single element render mode.
Format:
1
or1-3
or1-3;6;7-8
or*-3;5-*
- only evaluated if
paragraphScope
is set torange
paragraphScope
A string property that defines how paragraphs are to be output if in single element render mode.
Values:
all
: to render all paragraphsrange
: to render the range of paragraphs provided byparagraphRange
paragraphHeadings
h1
, h2
, h3
) are counted as paragraphs (true
) or not (false
)Example
As an example, see the following (on an out-of-the-box AEM instance):
/apps/core/wcm/config/com.adobe.cq.dam.cfm.impl.component.ComponentConfigImpl-core-comp-v1.config
This contains:
dam.cfm.component.resourceType="core/wcm/components/contentfragment/v1/contentfragment"
dam.cfm.component.fileReferenceProp="fragmentPath"
dam.cfm.component.elementsProp="elementName"
dam.cfm.component.variationProp="variationName"