[Content Fragment] Building a common model for all - good approach? | Community
Skip to main content
Level 3
April 30, 2021
Solved

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

  • April 30, 2021
  • 1 reply
  • 1181 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

@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.

 

1 reply

BrianKasingli
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
April 30, 2021

@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.

 

baoyu_liAuthor
Level 3
April 30, 2021
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?