Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Issue with sling:resourceSuperType AEM 6.3

Avatar

Level 2

Hi,

We are in process of upgrading from AEM 6.0 to AEM 6.3. We also wanted to use sightly for our existing code base. We are converting the existing templates and components as per sightly.

Templates use sling:resourceSuperType to inherit from page component provided OOB

e.g:

--apps

     --myProject

          --components

               --pages

                    --base-page (sling:resourceSuperType as foundation/components/page)

                         -- body.jsp

                         --head.jsp

                         --content.jsp

                         --headlibs.jsp

                         --navigation.jsp

                    -- inner-page (sling:resourceSuperType as base-page)

                         -- content.jsp

                         -- headlibs.jsp

This is done to inherit common content in new templates created and the changes are specified in jsp files added to the new template.

While creating the page using the 'inner-page' template, content.jsp and headlibs.jsp are loaded from inner-page and rest of the items on the page are loaded from files as placed under the base-page because of sling:resourceSuperType used.

Now AEM 6.3,

1. base-page sling:resourceSuperType changed to wcm/foundation/components/page

2. all the jsp's mentioned above are changed to .html

3. code changes done as per sightly.

Now if we create a page using 'inner-page' template, the page is displayed blank. if we change the filename under /inner-page/content.html to /inner-page/inner-page.html, the page displays the content as per the inner-page.html. But the content from /base-page are not loaded despite using the sling:resourceSuperType as /apps/myProject/components/pages/base-page

What is it that we are doing wrong here in using sling:resourceSuperType?

12 Replies

Avatar

Community Advisor

Hi Anuj

       Just few questions

  1. When you create a page using base page template, is it loading properly ?
  2. Assuming the answer to the above question is yes, does your base-page's body.html has a proper content.html include , something like this <sly data-sly-include="content.html"></sly> ? If this include is not present in this way, it will not look for the content.html from inner-page (using the sling resolution principles) when you create a page out of that template
  3. Will it be possible to share the sample code as Feike mentioned, so that we can have a look to see what the real issue could be if both the above steps are working fine

Thanks

Veena

Avatar

Level 2

Hi Veena,

Thanks for the reply. i could see the error message if i switch to Developer mode from the touch UI. there was some issue with head.html that was messing up the resource Super Type declaration. I removed head.html and it worked fine.

Now facing a new issue. i have posted a reply to main thread. It would be wonderful if a you can point us in the right direction. We are not sure if this is something missing in template or it component issue.

Thank You So much for all the help.

Avatar

Community Advisor

Hi Anuj

     I am checking the code now. I will get back once I figure out the cause

Thanks

Veena

Avatar

Community Advisor

Hi Scott

          I could see that they have followed the same structure. But basically they are trying to rewrite the existing code and hence could be having some issues in the code which is breaking their pages.

Thanks

Veena

Avatar

Level 10

For AEM 6.3 - check this article for some tasks that may help you. It breaks down all site sections in different pieces and uses HTL (Sightly proper name):

Scott's Digital Community: Creating your First Adobe Experience Manager 6.3 website

There is also a video.

Avatar

Level 2

Hi All,

I think i got the issue with the sling:resourceSuperType issue.

1. existing head.html is not in sync with the head.html available as part of wcm/foundation/components/page. There are loads of changes and i would need to refactor head.html and headlibs.html.

There is one issue that will slow down our process of changing to sightly. as a temporary fix for the issue above, i have replaced the head.html and headlibs.html with the file at wcm/foundation/components/page. the template is displayed fine now. but if i try to drop any component on the page, i get the errors in dev console. Can you tell me if this is something missing in the template or it has something to do with the component? we are refactoring the components as well. Below is the error log:

core.js:20351 Handler of component is invalid -> SyntaxError: Unexpected token ) at Object.ns.util.sanitizeCQHandler (http://localhost:4504/libs/cq/gui/components/authoring/editors/clientlibs/core.js:6846:39) at String.<anonymous> (http://localhost:4504/libs/cq/gui/components/authoring/editors/clientlibs/core.js:8592:67) at Function.each (http://localhost:4504/etc.clientlibs/clientlibs/granite/jquery.js:376:19) at constructor._loadConfig (http://localhost:4504/libs/cq/gui/components/authoring/editors/clientlibs/core.js:8561:15) at constructor.updateConfig (http://localhost:4504/libs/cq/gui/components/authoring/editors/clientlibs/core.js:8640:22) at http://localhost:4504/libs/cq/gui/components/authoring/editors/clientlibs/core.js:28071:26 at Array.forEach (native) at Array.ns.editables.self.add (http://localhost:4504/libs/cq/gui/components/authoring/editors/clientlibs/core.js:28060:23) at Object.<anonymous> (http://localhost:4504/libs/cq/gui/components/authoring/editors/clientlibs/core.js:21909:46) at fire (http://localhost:4504/etc.clientlibs/clientlibs/granite/jquery.js:3232:31)

Sample package available at:

https://drive.google.com/open?id=0Bxiqz8e_g7ACWUFWMW5FRWpfcmc

Avatar

Community Advisor

Hi Anuj

    I ran your package. I tried adding a component to the template and was able to do the same. I could author the component too.  I couldn't replicate the issue you are mentioning. It could be related to something else if it still persists. You package basically looks good in the perspective smacdonald2008 pointed out !

1221546_pastedImage_1.png

Thanks

Veena

Avatar

Level 2

Hi Veena,

I see that you have used the OOB component. Maybe the issue is because of our component. the component is still under refactoring. I think we are good to proceed as the this one template is working fine. We can follow the insights shared here to refactor the code for other templates and components.

Thank you so much everyone for the help.

Regards,

Anuj Rattan

Avatar

Level 3

Unfortunately, includes are defined with extension, so that if generic page template went to html that will cause those jsp files won't be included.

What you can do ASAP is just creating those files with jsp you have (that are overriding base page) with html extension and just simply load JSP as include, like:

<sly data-sly-include="your-file.jsp" />

But you have to check that base page is having same structure as it had previously.

Avatar

Level 3

Ive created a sample package to test this our further, only works using <cq:include script="overrideme.jsp"/>

Here is the code:

GitHub - wildone/aem-responsivegrid-slingresourcesupertype: Test Sling Resource Super Type support i...