1

I am duplicating this [question] (How to set nested component linking level in DXA). My issue is with "R2 Render Content" Component Template in Web 8.5 and DXA 2.0

A developer created a component which has two levels of linked components and finds that the lowest level component does not fully render in the JSON coming from the Component Template.

Since DXA is based on DD4T which can be configured to do this, how can we set the number of levels in DXA?

6
  • Stupid question but are the templates changed on the context publication (if you have them localized) and checked in?
    – Atila Sos
    Oct 23, 2018 at 14:24
  • Check the Debug Log output of the CT/PT in Template Builder. Oct 23, 2018 at 20:45
  • There is not much in the output log as such, no errors, no debug information. And just to add some more information to the question, these are custom schemas/models/views and we are not using core. When we reach the 3rd level while debugging, it throws an error saying "unable to map field xxx with property xxx". @Atila: Yes, everything is checked in.
    – GJin
    Oct 24, 2018 at 19:31
  • Is the log level set to Debug in the Template Builder, when initially installed it's not?
    – Atila Sos
    Oct 24, 2018 at 19:43
  • 1
    Can you update your Question and add thid debug output (formatted)? It is very hard to read like this. Oct 26, 2018 at 14:44

2 Answers 2

4

You can see in the debug output that the Component Links are not expanded because a Data Presentation exists.

DXA 2.0 supports so-called dynamic expansion of linked Components. With dynamic expansion, the linked Component is not expanded on CM-side, but published separately as a DCP (the so-called Data Presentation). Eventually, the linked Component will still get expanded, but this is done dynamically by the DXA Model Service.

You can choose for dynamic expansion by associating the Schema of the linked Component with the “Generate Data Presentation” Dynamic Component Template.

According to the log output, this is the case for your linked Components. If this is not desired, you should remove your Schema from the list of Related Schemas of the “Generate Data Presentation” CT.

The number of link levels to expand Component links statically can be configured as a parameter in TBBs “Render Page Content” and “Render Component Content”.

2

Rick: Your comment did help us send us in the right direction, so thanks for that.

Our implementation has various instances of using components upto level of 3. As per Rick's comment, we decided to go with the "dynamic expansion" of linked components but our model was throwing a "null pointer exception" when it reached 3rd level. In order to resolve that, we increased the depth level of "Generate Data Presentation" to 3 which helped the model to get upto 3 level of our linked components.

"Render Page Content" and "Render Component Content" already had depth level of 3 which had not helped in our particular case.

1
  • sometimes your content ViewModel not required that expansion data on your webapp, those cases aproaches, • Set “dxa.errors.missing-entity-suppress” to “true” This ensures that any missing information is at a level not needed for the views and this does not stop the model service from providing the Page Model Data with all available data
    – Velmurugan
    Oct 31, 2018 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.