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

Avatar

Avatar
Boost 1
Level 1
baoyu_li
Level 1

Like

1 like

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
baoyu_li
Level 1

Like

1 like

Total Posts

8 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
baoyu_li
Level 1

29-04-2021

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!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

29-04-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.

 

Answers (0)