I have a bit of a thorny issue.
I have a component (we'll call it trouble-component) that is configured only once on a page, let's say the home page.
The presence of the component in that page is overridden with data-sly-resource in the structure (we'll call it generic structure) that is used by that very page (home page and many other pages), so that each page using that structure will contain that resource which was added to the home page in a fashion similar to the following:
<sly data-sly-resource="${'/content/path-to-homepage/jcr:content/trouble-component' @ resourceType='my-project/components/content/trouble-component'}"></sly>
This produces the desired outcome, which is that:
- the home page contains the node trouble-component
- the component is configured in the home page and that configuration is spread across in every other page that uses that resource, thanks to the data-sly-resource in the structure generic structure.
- all pages with a generic structure include the component
Now the issue.
Due to the way this is configured, the only page node containing (in its jcr:content, or below) the trouble-component is the home page and when I use a Model Exporter to map and export the properties of the other pages which use generic structure, even though the page itself will contain the trouble-component, it's corresponding JCR node will not, so that - and this is the issue - the Model Exporter will not expose the content of trouble-component when exporting/mapping any other page that is not home page.
How can I - when exporting the JCR representation of the node of a page (via Sling Model Exporter, for example, or in any other way) that extends generic structure and thus will contain the trouble-component, export the configuration of the trouble-component that is centralized in the home page?
I realize this is a bit of a thorny question and I hope I have made myself clear.
If a more appropriate architecture is to be contemplated in order to:
- centralize the configuration of a trouble-component only in one page
- have that same configuration and component used coherently in all other pages with structure generic structure
- be able to export a representation of each page node including the trouble-component without singularly include the trouble-component in each of those pages
I am more than willing to contemplate a different solution.
In the meantime, I am grateful for whatever input, advice or insight you'll be able to provide,
Parag Dalal.