Expand my Community achievements bar.

HTL/Sightly templates (page) and components not compiling/rendering

Avatar

Level 2

When I create a new HTL template (page)/component or edit an existing one, it does not compile/render. The page just gets stuck perpetually loading. Switching to "Development Mode" in "Apache Sling Scripting Sightly Engine Configuration" worked to render it once, but not again.

Does anyone know why this would be occurring?

12 Replies

Avatar

Administrator

Any error in error.log or browser console?

~kautuk



Kautuk Sahni

Avatar

Level 2

I can't see anything in the error.log and there is nothing in console.

I came in this morning and both test templates compiled. I made a change to one which it compiled again, and then I made another change to it and it stopped compiling.

Avatar

Level 5
Level 5

Geoffrey McIntyre wrote...

I can't see anything in the error.log and there is nothing in console.

I came in this morning and both test templates compiled. I made a change to one which it compiled again, and then I made another change to it and it stopped compiling.

 

can you try restarting Apache Sling Scripting Sightly Engine (org.apache.sling.scripting.sightly) bundle.?

~ VAr

Avatar

Level 2

Awesome, making progress. So now this allows one of my template components in the directory (/apps/site/components/page/) to continually be updated with no issues. My other template in (/apps/site/components/page/2017/) though won't compile and when I do try to update and compile it, it also causes the other template to stop compiling.

Upon further investigation it is definitely being caused by having the template component in a sub-directory of page.

Avatar

Level 2

It is really basic, two templates in the template directory (/apps/site/templates), two components in the component page directory (/apps/site/components/page) but one is in a sub-directory. (/apps/site/components/page/2017). The components have resourceSuperType: wcm/foundation/components/page and the templates are pointing to their corresponding component.

Both template components are basic HTL:
<html>
    <head>
        <div data-sly-include="/libs/wcm/core/components/init/init.jsp"></div>
    </head>
    <body>
        <h1>Simple Page Component Using Sightly 20</h1>
        <h1>You can add components below</h1>
        <div data-sly-resource="${ @path='par', resourceType='foundation/components/parsys'}"></div>
    </body>
</html>

I can reproduce this in a fresh copy of AEM 6.2 SP1 as well.

Avatar

Employee

I would not use the <div> in the head, because it will generate invalid HTML.

See this : /libs/wcm/foundation/components/page/page.html

this will have all the logic:  <head data-sly-include="head.html"></head>

Avatar

Level 2

I completely agree that it shouldn't be a div in the head. This was just the last template from example sites I tried before figuring out the fact that it is having issues with the template component being in a sub-directory. Both templates are the same except for the directory their component is in, but only one of them works. I made the suggested change and it is the same result.

Avatar

Level 2

I just copied the second template component which doesn't work into the same directory as the one that does work. I then copied the template of the one that doesn't work to the same directory as the rest and pointed it at the new copy of the template component and it works fine.

It is definitely something to do with having a page component in (/apps/site/components/page) vs (/apps/site/components/page/2017).

Avatar

Level 2

This was not solved, creating a sub-directory "2017" in the component sub-directory "page" (/apps/site/components/page/2017) still causes the compiler to crash.

I simply worked around this issue by creating a new single level component sub-directory for my components "page2017" (/apps/site/components/page2017).

Avatar

Employee

Are you using AEM6.1 or AEM6.2?

Can share you a code-package where we can see the issue?

Avatar

Level 2

I am using AEM 6.2. I will make a package as soon as I get a chance, but I assume that means you cannot reproduce it simply by having the template component two sub-directories deep in the components directory, as described above?