Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

How many Templates for an AEM Headless Implementation

Avatar

Level 10

Hi,

 

1. For an AEM Headless Implementation, we create 1. content using Content Fragments and  2. define an AEM Content Services end-points using AEM Sites’ Templates and Pages that expose the  data as JSON.

How to know how many of Content Fragments and AEM Sites’ Templates are required for a specific implementation? Let us assume a medium sized implementation.

I am aware that it is dependent on functionalities.

Is there a thumb rule or so?

 

2. AEM Sling Models also expose the data to outside world as JSON. When should I use Sling Models Vs the above model?

 

Appreciate all your responses.

 

Thanks,

Rama.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

You can start with one Experience Fragment Template and call it as CaaS API template. It will have a single container where authors can drop the components and refer content fragments. You will have to do a discovery exercise to find out how many content fragment models you need to create. As the content fragment models will be derived from the different CaaS use cases in your project. 

 

Regarding your second question regarding using Sling models. Yes that will work as well but you should also think about using the content in wider set of applications and how you will manage it. Lets say you have a carousel component and it has a sling model exporter. And you get a use case to expose its content to an external application.

Would you expose the JSON of the carousel directly from the created page in your website? You will probably create a new experience fragment with carousel dropped in it and then share that experience fragment JSON to external application. The reason you will do it this way is because this way the end consumers like website page can have their own separate life cycles or they are decoupled from each other. It can happen that the website page is unpublished as it is not required any more on the website but the external application still wants to consume the content. 

You can consider experience fragment template as an orchestration layer using which can produce different JSON outputs for different consuming applications. Suppose another application wants to consume the same carousel content but along with the carousel copy it may require another set of fields may be from another component or content fragment. In this case you can easily build a new experience fragment and create a dedicated API endpoint URL for the consuming application without affecting other applications which are only consuming the carousel copy. 

 

Also, now suppose there is another component in your website which requires same content copy on the carousel. But that is a different component? Now how will you share the content copy and manage it in one single place. Here the content fragments can come into play as you can manage the content copy in a central content fragment and expose it to carousel component as well as another component which requires the same content. 

 

I hope this answers your question. 

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

You can start with one Experience Fragment Template and call it as CaaS API template. It will have a single container where authors can drop the components and refer content fragments. You will have to do a discovery exercise to find out how many content fragment models you need to create. As the content fragment models will be derived from the different CaaS use cases in your project. 

 

Regarding your second question regarding using Sling models. Yes that will work as well but you should also think about using the content in wider set of applications and how you will manage it. Lets say you have a carousel component and it has a sling model exporter. And you get a use case to expose its content to an external application.

Would you expose the JSON of the carousel directly from the created page in your website? You will probably create a new experience fragment with carousel dropped in it and then share that experience fragment JSON to external application. The reason you will do it this way is because this way the end consumers like website page can have their own separate life cycles or they are decoupled from each other. It can happen that the website page is unpublished as it is not required any more on the website but the external application still wants to consume the content. 

You can consider experience fragment template as an orchestration layer using which can produce different JSON outputs for different consuming applications. Suppose another application wants to consume the same carousel content but along with the carousel copy it may require another set of fields may be from another component or content fragment. In this case you can easily build a new experience fragment and create a dedicated API endpoint URL for the consuming application without affecting other applications which are only consuming the carousel copy. 

 

Also, now suppose there is another component in your website which requires same content copy on the carousel. But that is a different component? Now how will you share the content copy and manage it in one single place. Here the content fragments can come into play as you can manage the content copy in a central content fragment and expose it to carousel component as well as another component which requires the same content. 

 

I hope this answers your question. 

Avatar

Level 10
Hi Kunal, Let me summarize my understanding here. 1. I could assume Experience Fragment Template that I could call CAS API Template. But this wll house many components and references to many content fragments. How many such content fragments to be created for including like this wll be known during the Discovery phase. 2. Sling Models also achieve the objective of exposing JSON content to outside world. But it is more primitive way of exposing content, there is nothing like publishing and unpublising. So, the exposed content is always available. I highly appreciate all your insights. Rama.