Content Fragments in AEM - High level pointers

Content Fragments(CF), an implementation for re-using content across multiple locations/channels, a means for headless-CMS.

jcr:primaryType Content Fragments(CF) is of asset type - dam:Asset to hold mixed media content - Text and Assets.
Types
  • Simple Fragment, Created out of Fragment Template named "Simple Template" OOB
  • Structured Fragment, Created out of Content Fragment Model(CFM)
Note :  Per 6.5 Adobe docs, it is recommended to create CF using CFM.
Simple Template Defines single "Multiline text" element.
Content Fragment Model(CFM) Offers different data types to define the type of content.(Single line, Multiline text, Date field, Numberfield, dropdown and so on OOB and an option to render each of this in multifield format as well. )
Elements Each of this data types that we define as part of CFM is referred to as Elements in CF
Mutiline Text element
  • It is available in 3 types/formats
    • Rich Text, text/html
    • Plain Text, text/plain
    • Markdown, text/x-markdown
  • It has options to switch between above said types, Text Statistics(data about the content like No. of words, characters, sentences), Import Content(Option to locate plain ".txt" file to include content), Sync with Master(Copy changes from Master to Variation and not vice-versa)
Note :  Assets cannot be included in Plain text mode. Markdown can have reference to Assets per its syntax. 
Variations We can create as many Variations out of Master which in turn has options to "Rename, Delete, Sync with Master".
Note : Sync with Master is enabled only for Multiline Text element/data type.
Associated ContentAn option in CF lets us to add related Collection to the fragment which will help list related assets when including CF in site pages.
Note : We can add CF itself to be part of the same collection for easy tracking. 
Inclusion in site pagesCreated CF can then be added to pages via Content Fragment and Content Fragment List component from General group or creating proxy out of core components.
In-between contentWhen included in page, we will have a means to add "in-between" content which can be
  • Component
  • Asset
  • Associated content.
Note: These are part of the page content and not the fragment content. (as it is authored at page level after locating content fragment)
API/Access programmaticallyBelow mentioned interfaces are available for accessing content fragments/templates/elements/variations and its related from com.adobe.cq.dam.cfm.*
Pre-requisites(before creating CFM/CF)CFM is part of configuration and hence the same needs to be enabled in /conf via Configuration Browser. (General -> Configuration Browser)
  • Eg. Sample CFM for project named "learnings" - /conf/learnings/settings/dam/cfm/models/events
  • In this case, CFM should be allowed at learnings folder level (Folder properties)
As CF being an asset and is to be created using CFM (which acts as a template for creating CF), the same needs to be allowed at desired DAM folder level.
  • Eg. If CF is to be created for project "learnings" then at /content/dam/learnings -> Properties -> Cloud services -> Cloud Configuration field -> Locate respective "/conf" path (/conf/learnings)

Use cases:
  • Content related to events, news articles, press release, product details can be part of CF where we can define structured content via CFM.
  • Single multiline content scenarios like privacy, terms and conditions can be part of CF, defined at project level can be used across locales. (by leveraging translation)
Related screenshots for reference:



Comments

Post a Comment

Popular posts from this blog

Embedding Third party dependency/OSGi bundle in AEM application hosted in AEMasCS

OSGI Factory Configuration implementation

Creation of Template Types for Editable templates