Expand my Community achievements bar.

SOLVED

refer content fragment in another content fragment

Avatar

Level 7

Hi,

Environment: AE, 6.5.7

Core components: 2.12.2

 

I am trying below content reference type to refer other content fragments in a content fragment

 

sreenu539_0-1649440849043.png

 

when I do http://localhost:4502/api/assets/core-components-examples/library/primary.json

Following is the result, I was expecting .json will result in referenced content fragment text as well but it is displaying path of content fragment.

 

sreenu539_1-1649440957432.png

 

When I use content fragment on a page , content reference path is displayed not text authored inside content fragment.

 

sreenu539_2-1649441238860.png

 

Is there something I am missing here? 

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 6

No, that is the normal behaviour. If you want the json from the child content fragment, you will have to write a custom Sling Model Exporter for Content Fragment I believe.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

No, that is the normal behaviour. If you want the json from the child content fragment, you will have to write a custom Sling Model Exporter for Content Fragment I believe.

Avatar

Community Advisor

@sreenu539 As @ibishika it is default behavior of any nested reference of resources,  it could be page,asset or content fragments.

 

If you want inner/nested fragments in json, using sling model exporter for parent content fragment and pull inner fragment as object instead of path.

 

If you want in page, you have to write similar custom logic in component sling model