May 1, 2020
Estimated Post Reading Time ~

Understanding How Adobe AEM Delivers Headless Content

Headless content allows content managers to manage and reuse content from a single repository, where it can be Adobe AEM CRX or OAK repository. Headless content can be delivered to multiple channels including website, mobile, tablet, internet of things devices or smartwatches, etc. Headless content which can be called in form JSON using APIs to consume in a different type of application listed below:
  • Single page application
  • Mobile applications
  • Custom applications
Headless content provides the following benefits when used in Adobe AEM.
  • Content created as headless within Adobe Experience Manager (AEM) can be delivered independently of the presentation layer to different channels.
  • Content can be pushed easily to any medium based on defined category for example. /content/experience-fragments/facebook/mobile-content or /content/experience-fragments/watches/mobile-content.
  • Content elements can be added, removed, or modified independently of having an impact on final content rendering to any channel.
Adobe Experience Manager (AEM) comes with a powerful API known as DefaultGetServlet which lies under the Apache Sling web framework to use Adobe Experience Manager (AEM) as a headless content management system. This servlet allows content administrators or content authors to call this API passing number 1,2 or 3 and so on to call multiple level content or .infinity or .-1 to get all content in a recursive manner.

Adobe AEM provides a different powerful tool to create headless content management system listed below:
  • Experience Fragments
  • Fluid Experiences
  • Content fragment models
Adobe AEM introduced content fragment models with service pack 6.3.1.0 which provides the ability to structure multiple content types in fragment models; including text, numerical data, date and time, Boolean, enumerated lists, and content references. Models can be exposed in the form of JSON to consumed in the different channels as headless content.

Here are steps to create content fragment models.

Enable Content Fragment Models Configuration
This is required to have mapping enabled on the folder under which custom created content fragment models templates will be available to create content fragments.
  1. Navigate to Tools > General > Configuration Browser
  2. Use Create button to create a configuration
  3. Provide Title and select Content Fragment Models and then click on the Create button in the popup window.


Create Content Fragment Model Structure
This will create content fragments models or template which will be base for creating different content fragment models for headless content.
  1. Navigate to Tool > Assets > Content Fragment Models
  2. Open HCL-CFM-Configuration created in the configuration step
  3. Use create button to create a model
  4. Provide Model Title and description and click on the Create button. This will create empty models.



Define Content Fragment Model Structure
Navigate to Tool > Assets > Content Fragment Models
Navigate to HCL-CFM-Configuration holding empty content fragment models created in the previous step
Open Articles model to configure, add required fields within it.

Drag & Drop required fields from the right side to panel appearing on the left side.

Publish a content fragment model to make it available with the assets folder to create different content fragments to deliver headless content.


Create Articles Content Fragments
In this step, we will create content fragments that can be accessed as JSON to deliver as headless content management systems to different channels.
Navigate to Assets
Use Create button to create a folder which will hold all your content fragment
Open folder properties and go to Cloud Services tab
Select cloud configuration to make all content fragment structure template available under this folder to create different Article or News content fragments.


Save configuration using Save & Close button
Open folder created in the previous step.
Use Create button to create content fragments within this folder. You will have a content fragments template (Article, News) along with the OOTB Simple Fragments template.

Select the Articles template and provide Title and Name to your fragment.
Open created a fragment to fill content and then use the Save button to save this in the repository.

Once done creating all content fragments; all will appear within a folder created by you.


EXPOSING CONTENT AS HEADLESS CONTENT IN FORM OF JSON
As described in this blog using DefaultGetServlet content can be exposed in the form of json to consume it within different channels. This is how it can be accessed. Custom JSON exporter or Sling Servlet can also be created to have content fragments model’s data in the required JSON format.



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.