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

[Content Fragment] Building a common model for all - good approach?

Avatar

Level 3

Hi all,

 

Here in our organization we are trying to use CF to expose content from AEM.

 

As we roughly knows the scope of consuming parties and specific CF entities they need, instead of modeling one CF model for each every type of entity, we are considering to do one common model which contains the super set of all fields needed from these entities.

 

Will this approach work? What are main caveats with it if any?

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@baoyu_li,

It would be the first to understand best the JSON contract that you are expecting. From there, we can provide you with some advice on how to create content fragment models, in a strategic way, where you are not creating a new content fragment model for each content fragment. 

However, you are on the right path. Planning and designing reusable content fragment models is the best way to keep a sustainable content architecture in AEM.

As we wait for your JSON example, here's what I would do to tackle your problem:

  1. Look at the JSON payload and what you are expecting to expose.
  2. Identify reusable JSON data objects; these will be the common content fragments.
  3. Design content fragment models with properties (kinda like UML diagram)
  4. Execution (create the CFM, CF, core.components.page)

Caveats of having a common content fragment model for everything would be useless properties being exposed.

 

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

@baoyu_li,

It would be the first to understand best the JSON contract that you are expecting. From there, we can provide you with some advice on how to create content fragment models, in a strategic way, where you are not creating a new content fragment model for each content fragment. 

However, you are on the right path. Planning and designing reusable content fragment models is the best way to keep a sustainable content architecture in AEM.

As we wait for your JSON example, here's what I would do to tackle your problem:

  1. Look at the JSON payload and what you are expecting to expose.
  2. Identify reusable JSON data objects; these will be the common content fragments.
  3. Design content fragment models with properties (kinda like UML diagram)
  4. Execution (create the CFM, CF, core.components.page)

Caveats of having a common content fragment model for everything would be useless properties being exposed.

 

Avatar

Level 3
Thanks Brian, will share sample JSON once having it. For now a quick question, what if we design one common model with x number of fields initially but need to add more fields after some time?

Avatar

Community Advisor
This will become more complicated, but I have seen people use the reference path component to reference to another CF.