Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

baoyu_li
Level 2
Level 2

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
BrianKasingli
Correct answer by
Community Advisor
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
BrianKasingli
Correct answer by
Community Advisor
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

baoyu_li
Level 2
Level 2
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?
BrianKasingli
Community Advisor
Community Advisor
This will become more complicated, but I have seen people use the reference path component to reference to another CF.