Sling Resource Rendering Inheritance

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Sling Resource Rendering Inheritance

Andreas Schaefer-3
Hi

As a long time CQ / AEM backend developer I ran into some issues
to adjust to Sling.

I have a resource ‘Home Page’ that should render a JCR node as
a HTML page. The Home page component then only adjust
the layout of the Body and Head and the rest should be inherited from
its Resource Super Type “Page’. I tried that but it does not render
without the home.html as well as the footer missing in Home is not
picked up.

This is my configuration:

1. JCR Content Node (/content/sample/home)

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
         jcr:primaryType="nt:unstructured"
         jcr:title="Sample Home"
         jcr:description="Sample Home Page"
         sling:resourceType="sample/home"
         sling:resourceSuperType="sample"
/>

2. Home Page configuration (/apps/sample/home):

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
         jcr:primaryType="sling:Folder"
         jcr:title="Sample Home Page Component"
         jcr:description="Sample Home Page Component woth HTL"
         sling:resourceSuperType="sample/page"
/>

This only contains the head.html and body.html file.

3. Page Configuration (/apps/sample/page):

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
         jcr:primaryType="sling:Folder"
         jcr:title="Sample Page Component"
         jcr:description="Sample Page Component"
/>

This contains the page.html which includes the head, body and footer.html file.

This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.

Any way to make the work like in AEM?

I am pretty sure that I don’t see the forest because of the trees here
but I could not figure out how to do it right even when looking at the
Sling Samples.

Thanks - Andy Schaefer
Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Roy Teeuwen
Hey Andreas,

I made an example package in sling-9, you can use composum to install the package.

http://www12.zippyshare.com/v/nWrL1Azm/file.html

It works for me, I made the following:

/apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
/apps/idoneus/components/home => supertype is page, and overwrites the header.html
/content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
/content/indoneus/en/test-page => is a normal page, has as header "Header base page"

Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference

Greets,
Roy



> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>
> Hi
>
> As a long time CQ / AEM backend developer I ran into some issues
> to adjust to Sling.
>
> I have a resource ‘Home Page’ that should render a JCR node as
> a HTML page. The Home page component then only adjust
> the layout of the Body and Head and the rest should be inherited from
> its Resource Super Type “Page’. I tried that but it does not render
> without the home.html as well as the footer missing in Home is not
> picked up.
>
> This is my configuration:
>
> 1. JCR Content Node (/content/sample/home)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>         jcr:primaryType="nt:unstructured"
>         jcr:title="Sample Home"
>         jcr:description="Sample Home Page"
>         sling:resourceType="sample/home"
>         sling:resourceSuperType="sample"
> />
>
> 2. Home Page configuration (/apps/sample/home):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>         jcr:primaryType="sling:Folder"
>         jcr:title="Sample Home Page Component"
>         jcr:description="Sample Home Page Component woth HTL"
>         sling:resourceSuperType="sample/page"
> />
>
> This only contains the head.html and body.html file.
>
> 3. Page Configuration (/apps/sample/page):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>         jcr:primaryType="sling:Folder"
>         jcr:title="Sample Page Component"
>         jcr:description="Sample Page Component"
> />
>
> This contains the page.html which includes the head, body and footer.html file.
>
> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>
> Any way to make the work like in AEM?
>
> I am pretty sure that I don’t see the forest because of the trees here
> but I could not figure out how to do it right even when looking at the
> Sling Samples.
>
> Thanks - Andy Schaefer

Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Andreas Schaefer-3
Hi Roy

I tried to download your example but I am not going to install
an Installer software just to see a ZIP file.

Can you share this file by any other means?

Thanks - Andy Schaefer

> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:
>
> Hey Andreas,
>
> I made an example package in sling-9, you can use composum to install the package.
>
> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>
> It works for me, I made the following:
>
> /apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
> /apps/idoneus/components/home => supertype is page, and overwrites the header.html
> /content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
> /content/indoneus/en/test-page => is a normal page, has as header "Header base page"
>
> Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference
>
> Greets,
> Roy
>
>
>
>> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>>
>> Hi
>>
>> As a long time CQ / AEM backend developer I ran into some issues
>> to adjust to Sling.
>>
>> I have a resource ‘Home Page’ that should render a JCR node as
>> a HTML page. The Home page component then only adjust
>> the layout of the Body and Head and the rest should be inherited from
>> its Resource Super Type “Page’. I tried that but it does not render
>> without the home.html as well as the footer missing in Home is not
>> picked up.
>>
>> This is my configuration:
>>
>> 1. JCR Content Node (/content/sample/home)
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>        jcr:primaryType="nt:unstructured"
>>        jcr:title="Sample Home"
>>        jcr:description="Sample Home Page"
>>        sling:resourceType="sample/home"
>>        sling:resourceSuperType="sample"
>> />
>>
>> 2. Home Page configuration (/apps/sample/home):
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>        jcr:primaryType="sling:Folder"
>>        jcr:title="Sample Home Page Component"
>>        jcr:description="Sample Home Page Component woth HTL"
>>        sling:resourceSuperType="sample/page"
>> />
>>
>> This only contains the head.html and body.html file.
>>
>> 3. Page Configuration (/apps/sample/page):
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>        jcr:primaryType="sling:Folder"
>>        jcr:title="Sample Page Component"
>>        jcr:description="Sample Page Component"
>> />
>>
>> This contains the page.html which includes the head, body and footer.html file.
>>
>> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>>
>> Any way to make the work like in AEM?
>>
>> I am pretty sure that I don’t see the forest because of the trees here
>> but I could not figure out how to do it right even when looking at the
>> Sling Samples.
>>
>> Thanks - Andy Schaefer
>

Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Roy Teeuwen
Hey Andreas,

Huh, I think you pushed the advertisement button or something, or maybe you have to click twice. Anyway, here, my dropbox:

https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1

Greetings,
Roy

> On 22 Mar 2017, at 18:26, Andreas Schaefer <[hidden email]> wrote:
>
> Hi Roy
>
> I tried to download your example but I am not going to install
> an Installer software just to see a ZIP file.
>
> Can you share this file by any other means?
>
> Thanks - Andy Schaefer
>
>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:
>>
>> Hey Andreas,
>>
>> I made an example package in sling-9, you can use composum to install the package.
>>
>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>
>> It works for me, I made the following:
>>
>> /apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
>> /apps/idoneus/components/home => supertype is page, and overwrites the header.html
>> /content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
>> /content/indoneus/en/test-page => is a normal page, has as header "Header base page"
>>
>> Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference
>>
>> Greets,
>> Roy
>>
>>
>>
>>> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>>>
>>> Hi
>>>
>>> As a long time CQ / AEM backend developer I ran into some issues
>>> to adjust to Sling.
>>>
>>> I have a resource ‘Home Page’ that should render a JCR node as
>>> a HTML page. The Home page component then only adjust
>>> the layout of the Body and Head and the rest should be inherited from
>>> its Resource Super Type “Page’. I tried that but it does not render
>>> without the home.html as well as the footer missing in Home is not
>>> picked up.
>>>
>>> This is my configuration:
>>>
>>> 1. JCR Content Node (/content/sample/home)
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>       jcr:primaryType="nt:unstructured"
>>>       jcr:title="Sample Home"
>>>       jcr:description="Sample Home Page"
>>>       sling:resourceType="sample/home"
>>>       sling:resourceSuperType="sample"
>>> />
>>>
>>> 2. Home Page configuration (/apps/sample/home):
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>       jcr:primaryType="sling:Folder"
>>>       jcr:title="Sample Home Page Component"
>>>       jcr:description="Sample Home Page Component woth HTL"
>>>       sling:resourceSuperType="sample/page"
>>> />
>>>
>>> This only contains the head.html and body.html file.
>>>
>>> 3. Page Configuration (/apps/sample/page):
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>       jcr:primaryType="sling:Folder"
>>>       jcr:title="Sample Page Component"
>>>       jcr:description="Sample Page Component"
>>> />
>>>
>>> This contains the page.html which includes the head, body and footer.html file.
>>>
>>> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>>>
>>> Any way to make the work like in AEM?
>>>
>>> I am pretty sure that I don’t see the forest because of the trees here
>>> but I could not figure out how to do it right even when looking at the
>>> Sling Samples.
>>>
>>> Thanks - Andy Schaefer
>>
>


signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Andreas Schaefer
Yeah, the have a big “Download Now” button and that is not the file.
I think the reason was that I use Safari w/o Flash and then the link won’t show.

That said your code words and the major difference I saw is that the inheritance
only works if it is in the /apps/<project folder name>/components folder. I tried
that after I got mine working by copying the working resource type definitions back
up to /apps/<project folder name>.

This structure works:

/apps
        /testApps
                /components
                        /home
                                body.html
                        /page
                                body.html
                                page.html

The page.html has a HTL import of body.html and it will take the one from actual
resource type (here testApps/components/home).

Can anyone from the sling team verify that? If so why, where is that defined and
is that configurable?

I used the sling sample Fling as an example but that does not use inheritance.

Thanks for you swift help - Andy Schaefer

> On Mar 22, 2017, at 11:05 AM, Roy Teeuwen <[hidden email]> wrote:
>
> Hey Andreas,
>
> Huh, I think you pushed the advertisement button or something, or maybe you have to click twice. Anyway, here, my dropbox:
>
> https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1
>
> Greetings,
> Roy
>> On 22 Mar 2017, at 18:26, Andreas Schaefer <[hidden email]> wrote:
>>
>> Hi Roy
>>
>> I tried to download your example but I am not going to install
>> an Installer software just to see a ZIP file.
>>
>> Can you share this file by any other means?
>>
>> Thanks - Andy Schaefer
>>
>>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:
>>>
>>> Hey Andreas,
>>>
>>> I made an example package in sling-9, you can use composum to install the package.
>>>
>>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>>
>>> It works for me, I made the following:
>>>
>>> /apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
>>> /apps/idoneus/components/home => supertype is page, and overwrites the header.html
>>> /content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
>>> /content/indoneus/en/test-page => is a normal page, has as header "Header base page"
>>>
>>> Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference
>>>
>>> Greets,
>>> Roy
>>>
>>>
>>>
>>>> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>>>>
>>>> Hi
>>>>
>>>> As a long time CQ / AEM backend developer I ran into some issues
>>>> to adjust to Sling.
>>>>
>>>> I have a resource ‘Home Page’ that should render a JCR node as
>>>> a HTML page. The Home page component then only adjust
>>>> the layout of the Body and Head and the rest should be inherited from
>>>> its Resource Super Type “Page’. I tried that but it does not render
>>>> without the home.html as well as the footer missing in Home is not
>>>> picked up.
>>>>
>>>> This is my configuration:
>>>>
>>>> 1. JCR Content Node (/content/sample/home)
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>      jcr:primaryType="nt:unstructured"
>>>>      jcr:title="Sample Home"
>>>>      jcr:description="Sample Home Page"
>>>>      sling:resourceType="sample/home"
>>>>      sling:resourceSuperType="sample"
>>>> />
>>>>
>>>> 2. Home Page configuration (/apps/sample/home):
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>      jcr:primaryType="sling:Folder"
>>>>      jcr:title="Sample Home Page Component"
>>>>      jcr:description="Sample Home Page Component woth HTL"
>>>>      sling:resourceSuperType="sample/page"
>>>> />
>>>>
>>>> This only contains the head.html and body.html file.
>>>>
>>>> 3. Page Configuration (/apps/sample/page):
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>      jcr:primaryType="sling:Folder"
>>>>      jcr:title="Sample Page Component"
>>>>      jcr:description="Sample Page Component"
>>>> />
>>>>
>>>> This contains the page.html which includes the head, body and footer.html file.
>>>>
>>>> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>>>>
>>>> Any way to make the work like in AEM?
>>>>
>>>> I am pretty sure that I don’t see the forest because of the trees here
>>>> but I could not figure out how to do it right even when looking at the
>>>> Sling Samples.
>>>>
>>>> Thanks - Andy Schaefer
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Henry Saginor-2
In reply to this post by Andreas Schaefer-3
Hi Andreas

I was looking at the configuration you provided in your initial e-mail. I noticed that sling:resourceSuperType under your home page content node is different from what’s under component node (“sample” vs “sample/page”). Have you tried deleting this property from the content node? It should be sufficient to just have sling:resourceSuperType on the component node for inheritance to work correctly.

Henry

> On Mar 22, 2017, at 10:26 AM, Andreas Schaefer <[hidden email]> wrote:
>
> Hi Roy
>
> I tried to download your example but I am not going to install
> an Installer software just to see a ZIP file.
>
> Can you share this file by any other means?
>
> Thanks - Andy Schaefer
>
>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:
>>
>> Hey Andreas,
>>
>> I made an example package in sling-9, you can use composum to install the package.
>>
>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>
>> It works for me, I made the following:
>>
>> /apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
>> /apps/idoneus/components/home => supertype is page, and overwrites the header.html
>> /content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
>> /content/indoneus/en/test-page => is a normal page, has as header "Header base page"
>>
>> Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference
>>
>> Greets,
>> Roy
>>
>>
>>
>>> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>>>
>>> Hi
>>>
>>> As a long time CQ / AEM backend developer I ran into some issues
>>> to adjust to Sling.
>>>
>>> I have a resource ‘Home Page’ that should render a JCR node as
>>> a HTML page. The Home page component then only adjust
>>> the layout of the Body and Head and the rest should be inherited from
>>> its Resource Super Type “Page’. I tried that but it does not render
>>> without the home.html as well as the footer missing in Home is not
>>> picked up.
>>>
>>> This is my configuration:
>>>
>>> 1. JCR Content Node (/content/sample/home)
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>       jcr:primaryType="nt:unstructured"
>>>       jcr:title="Sample Home"
>>>       jcr:description="Sample Home Page"
>>>       sling:resourceType="sample/home"
>>>       sling:resourceSuperType="sample"
>>> />
>>>
>>> 2. Home Page configuration (/apps/sample/home):
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>       jcr:primaryType="sling:Folder"
>>>       jcr:title="Sample Home Page Component"
>>>       jcr:description="Sample Home Page Component woth HTL"
>>>       sling:resourceSuperType="sample/page"
>>> />
>>>
>>> This only contains the head.html and body.html file.
>>>
>>> 3. Page Configuration (/apps/sample/page):
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>       jcr:primaryType="sling:Folder"
>>>       jcr:title="Sample Page Component"
>>>       jcr:description="Sample Page Component"
>>> />
>>>
>>> This contains the page.html which includes the head, body and footer.html file.
>>>
>>> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>>>
>>> Any way to make the work like in AEM?
>>>
>>> I am pretty sure that I don’t see the forest because of the trees here
>>> but I could not figure out how to do it right even when looking at the
>>> Sling Samples.
>>>
>>> Thanks - Andy Schaefer
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Andreas Schaefer-3
This also came from a Sling Sample (I think Fling but I am not sure).

But removing that is not enough. The only way to make it work is to place the components in
the folder ‘components’ under my apps folder.

- Andy

> On Mar 22, 2017, at 12:43 PM, Henry Saginor <[hidden email]> wrote:
>
> Hi Andreas
>
> I was looking at the configuration you provided in your initial e-mail. I noticed that sling:resourceSuperType under your home page content node is different from what’s under component node (“sample” vs “sample/page”). Have you tried deleting this property from the content node? It should be sufficient to just have sling:resourceSuperType on the component node for inheritance to work correctly.
>
> Henry
>
>> On Mar 22, 2017, at 10:26 AM, Andreas Schaefer <[hidden email]> wrote:
>>
>> Hi Roy
>>
>> I tried to download your example but I am not going to install
>> an Installer software just to see a ZIP file.
>>
>> Can you share this file by any other means?
>>
>> Thanks - Andy Schaefer
>>
>>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:
>>>
>>> Hey Andreas,
>>>
>>> I made an example package in sling-9, you can use composum to install the package.
>>>
>>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>>
>>> It works for me, I made the following:
>>>
>>> /apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
>>> /apps/idoneus/components/home => supertype is page, and overwrites the header.html
>>> /content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
>>> /content/indoneus/en/test-page => is a normal page, has as header "Header base page"
>>>
>>> Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference
>>>
>>> Greets,
>>> Roy
>>>
>>>
>>>
>>>> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>>>>
>>>> Hi
>>>>
>>>> As a long time CQ / AEM backend developer I ran into some issues
>>>> to adjust to Sling.
>>>>
>>>> I have a resource ‘Home Page’ that should render a JCR node as
>>>> a HTML page. The Home page component then only adjust
>>>> the layout of the Body and Head and the rest should be inherited from
>>>> its Resource Super Type “Page’. I tried that but it does not render
>>>> without the home.html as well as the footer missing in Home is not
>>>> picked up.
>>>>
>>>> This is my configuration:
>>>>
>>>> 1. JCR Content Node (/content/sample/home)
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>      jcr:primaryType="nt:unstructured"
>>>>      jcr:title="Sample Home"
>>>>      jcr:description="Sample Home Page"
>>>>      sling:resourceType="sample/home"
>>>>      sling:resourceSuperType="sample"
>>>> />
>>>>
>>>> 2. Home Page configuration (/apps/sample/home):
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>      jcr:primaryType="sling:Folder"
>>>>      jcr:title="Sample Home Page Component"
>>>>      jcr:description="Sample Home Page Component woth HTL"
>>>>      sling:resourceSuperType="sample/page"
>>>> />
>>>>
>>>> This only contains the head.html and body.html file.
>>>>
>>>> 3. Page Configuration (/apps/sample/page):
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>      jcr:primaryType="sling:Folder"
>>>>      jcr:title="Sample Page Component"
>>>>      jcr:description="Sample Page Component"
>>>> />
>>>>
>>>> This contains the page.html which includes the head, body and footer.html file.
>>>>
>>>> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>>>>
>>>> Any way to make the work like in AEM?
>>>>
>>>> I am pretty sure that I don’t see the forest because of the trees here
>>>> but I could not figure out how to do it right even when looking at the
>>>> Sling Samples.
>>>>
>>>> Thanks - Andy Schaefer
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Roy Teeuwen
Hey Andreas,

Have you checked my example? Did you find the difference? Can you elaborate a bit more

Greets,
Roy

> On 22 Mar 2017, at 22:27, Andreas Schaefer <[hidden email]> wrote:
>
> This also came from a Sling Sample (I think Fling but I am not sure).
>
> But removing that is not enough. The only way to make it work is to place the components in
> the folder ‘components’ under my apps folder.
>
> - Andy
>
>> On Mar 22, 2017, at 12:43 PM, Henry Saginor <[hidden email]> wrote:
>>
>> Hi Andreas
>>
>> I was looking at the configuration you provided in your initial e-mail. I noticed that sling:resourceSuperType under your home page content node is different from what’s under component node (“sample” vs “sample/page”). Have you tried deleting this property from the content node? It should be sufficient to just have sling:resourceSuperType on the component node for inheritance to work correctly.
>>
>> Henry
>>
>>> On Mar 22, 2017, at 10:26 AM, Andreas Schaefer <[hidden email]> wrote:
>>>
>>> Hi Roy
>>>
>>> I tried to download your example but I am not going to install
>>> an Installer software just to see a ZIP file.
>>>
>>> Can you share this file by any other means?
>>>
>>> Thanks - Andy Schaefer
>>>
>>>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:
>>>>
>>>> Hey Andreas,
>>>>
>>>> I made an example package in sling-9, you can use composum to install the package.
>>>>
>>>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>>>
>>>> It works for me, I made the following:
>>>>
>>>> /apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
>>>> /apps/idoneus/components/home => supertype is page, and overwrites the header.html
>>>> /content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
>>>> /content/indoneus/en/test-page => is a normal page, has as header "Header base page"
>>>>
>>>> Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference
>>>>
>>>> Greets,
>>>> Roy
>>>>
>>>>
>>>>
>>>>> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> As a long time CQ / AEM backend developer I ran into some issues
>>>>> to adjust to Sling.
>>>>>
>>>>> I have a resource ‘Home Page’ that should render a JCR node as
>>>>> a HTML page. The Home page component then only adjust
>>>>> the layout of the Body and Head and the rest should be inherited from
>>>>> its Resource Super Type “Page’. I tried that but it does not render
>>>>> without the home.html as well as the footer missing in Home is not
>>>>> picked up.
>>>>>
>>>>> This is my configuration:
>>>>>
>>>>> 1. JCR Content Node (/content/sample/home)
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>     jcr:primaryType="nt:unstructured"
>>>>>     jcr:title="Sample Home"
>>>>>     jcr:description="Sample Home Page"
>>>>>     sling:resourceType="sample/home"
>>>>>     sling:resourceSuperType="sample"
>>>>> />
>>>>>
>>>>> 2. Home Page configuration (/apps/sample/home):
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>     jcr:primaryType="sling:Folder"
>>>>>     jcr:title="Sample Home Page Component"
>>>>>     jcr:description="Sample Home Page Component woth HTL"
>>>>>     sling:resourceSuperType="sample/page"
>>>>> />
>>>>>
>>>>> This only contains the head.html and body.html file.
>>>>>
>>>>> 3. Page Configuration (/apps/sample/page):
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>     jcr:primaryType="sling:Folder"
>>>>>     jcr:title="Sample Page Component"
>>>>>     jcr:description="Sample Page Component"
>>>>> />
>>>>>
>>>>> This contains the page.html which includes the head, body and footer.html file.
>>>>>
>>>>> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>>>>>
>>>>> Any way to make the work like in AEM?
>>>>>
>>>>> I am pretty sure that I don’t see the forest because of the trees here
>>>>> but I could not figure out how to do it right even when looking at the
>>>>> Sling Samples.
>>>>>
>>>>> Thanks - Andy Schaefer
>>>>
>>>
>>
>


signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Roy Teeuwen
In reply to this post by Andreas Schaefer
Hey Andreas,

I am not sure why it is not working for you that way, but that should definitely still work, there is no dependency whatsoever to a folder being named "components", see my next examples:

page-example-2.zip: I moved everything right under /apps/idoneus, no /components => still works
page-example-3.zip: I moved everything to under /libs/idoneus => still works


Greets,
Roy

On 22 Mar 2017, at 19:48, Andreas Schaefer Sr. <[hidden email]> wrote:

Yeah, the have a big “Download Now” button and that is not the file.
I think the reason was that I use Safari w/o Flash and then the link won’t show.

That said your code words and the major difference I saw is that the inheritance
only works if it is in the /apps/<project folder name>/components folder. I tried
that after I got mine working by copying the working resource type definitions back
up to /apps/<project folder name>.

This structure works:

/apps
/testApps
/components
/home
body.html
/page
body.html
page.html

The page.html has a HTL import of body.html and it will take the one from actual
resource type (here testApps/components/home).

Can anyone from the sling team verify that? If so why, where is that defined and
is that configurable?

I used the sling sample Fling as an example but that does not use inheritance.

Thanks for you swift help - Andy Schaefer

On Mar 22, 2017, at 11:05 AM, Roy Teeuwen <[hidden email]> wrote:

Hey Andreas,

Huh, I think you pushed the advertisement button or something, or maybe you have to click twice. Anyway, here, my dropbox:

https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1

Greetings,
Roy
On 22 Mar 2017, at 18:26, Andreas Schaefer <[hidden email]> wrote:

Hi Roy

I tried to download your example but I am not going to install
an Installer software just to see a ZIP file.

Can you share this file by any other means?

Thanks - Andy Schaefer

On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:

Hey Andreas,

I made an example package in sling-9, you can use composum to install the package.

http://www12.zippyshare.com/v/nWrL1Azm/file.html

It works for me, I made the following:

/apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
/apps/idoneus/components/home => supertype is page, and overwrites the header.html
/content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
/content/indoneus/en/test-page => is a normal page, has as header "Header base page"

Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference

Greets,
Roy



On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:

Hi

As a long time CQ / AEM backend developer I ran into some issues
to adjust to Sling.

I have a resource ‘Home Page’ that should render a JCR node as
a HTML page. The Home page component then only adjust
the layout of the Body and Head and the rest should be inherited from
its Resource Super Type “Page’. I tried that but it does not render
without the home.html as well as the footer missing in Home is not
picked up.

This is my configuration:

1. JCR Content Node (/content/sample/home)

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
    jcr:primaryType="nt:unstructured"
    jcr:title="Sample Home"
    jcr:description="Sample Home Page"
    sling:resourceType="sample/home"
    sling:resourceSuperType="sample"
/>

2. Home Page configuration (/apps/sample/home):

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
    jcr:primaryType="sling:Folder"
    jcr:title="Sample Home Page Component"
    jcr:description="Sample Home Page Component woth HTL"
    sling:resourceSuperType="sample/page"
/>

This only contains the head.html and body.html file.

3. Page Configuration (/apps/sample/page):

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
    jcr:primaryType="sling:Folder"
    jcr:title="Sample Page Component"
    jcr:description="Sample Page Component"
/>

This contains the page.html which includes the head, body and footer.html file.

This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.

Any way to make the work like in AEM?

I am pretty sure that I don’t see the forest because of the trees here
but I could not figure out how to do it right even when looking at the
Sling Samples.

Thanks - Andy Schaefer






signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Andreas Schaefer
Hi Roy

Thanks for all your help.

At the end it turns out that I made a mistake when using the HTL include:

This was my first include:

    <sly data-sly-include="head.html"/>

which fails. But using this:

    <sly data-sly-include="${'head.html'}"/>

does work.

So on another node I saw some Sling apps (samples and Composum) that place
their components under /libs instead of /apps.

In AEM developers were told not to put anything under /libs and now Sling it going
the other way. Is there a reason for this shift. As far as I know there’s no difference.

Thanks for all your help - Andy

> On Mar 23, 2017, at 12:30 AM, Roy Teeuwen <[hidden email]> wrote:
>
> Hey Andreas,
>
> I am not sure why it is not working for you that way, but that should definitely still work, there is no dependency whatsoever to a folder being named "components", see my next examples:
>
> page-example-2.zip: I moved everything right under /apps/idoneus, no /components => still works
> page-example-3.zip: I moved everything to under /libs/idoneus => still works
>
> https://www.dropbox.com/s/3d64tqd62wb81n9/page-example-2.zip?dl=1 <https://www.dropbox.com/s/3d64tqd62wb81n9/page-example-2.zip?dl=1>
> https://www.dropbox.com/s/tw0edw4dddi9ksh/page-example-3.zip?dl=1 <https://www.dropbox.com/s/tw0edw4dddi9ksh/page-example-3.zip?dl=1>
>
> Greets,
> Roy
>
>> On 22 Mar 2017, at 19:48, Andreas Schaefer Sr. <[hidden email] <mailto:[hidden email]>> wrote:
>>
>> Yeah, the have a big “Download Now” button and that is not the file.
>> I think the reason was that I use Safari w/o Flash and then the link won’t show.
>>
>> That said your code words and the major difference I saw is that the inheritance
>> only works if it is in the /apps/<project folder name>/components folder. I tried
>> that after I got mine working by copying the working resource type definitions back
>> up to /apps/<project folder name>.
>>
>> This structure works:
>>
>> /apps
>> /testApps
>> /components
>> /home
>> body.html
>> /page
>> body.html
>> page.html
>>
>> The page.html has a HTL import of body.html and it will take the one from actual
>> resource type (here testApps/components/home).
>>
>> Can anyone from the sling team verify that? If so why, where is that defined and
>> is that configurable?
>>
>> I used the sling sample Fling as an example but that does not use inheritance.
>>
>> Thanks for you swift help - Andy Schaefer
>>
>>> On Mar 22, 2017, at 11:05 AM, Roy Teeuwen <[hidden email] <mailto:[hidden email]>> wrote:
>>>
>>> Hey Andreas,
>>>
>>> Huh, I think you pushed the advertisement button or something, or maybe you have to click twice. Anyway, here, my dropbox:
>>>
>>> https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1 <https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1>
>>>
>>> Greetings,
>>> Roy
>>>> On 22 Mar 2017, at 18:26, Andreas Schaefer <[hidden email]> wrote:
>>>>
>>>> Hi Roy
>>>>
>>>> I tried to download your example but I am not going to install
>>>> an Installer software just to see a ZIP file.
>>>>
>>>> Can you share this file by any other means?
>>>>
>>>> Thanks - Andy Schaefer
>>>>
>>>>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:
>>>>>
>>>>> Hey Andreas,
>>>>>
>>>>> I made an example package in sling-9, you can use composum to install the package.
>>>>>
>>>>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>>>>
>>>>> It works for me, I made the following:
>>>>>
>>>>> /apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
>>>>> /apps/idoneus/components/home => supertype is page, and overwrites the header.html
>>>>> /content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
>>>>> /content/indoneus/en/test-page => is a normal page, has as header "Header base page"
>>>>>
>>>>> Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference
>>>>>
>>>>> Greets,
>>>>> Roy
>>>>>
>>>>>
>>>>>
>>>>>> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> As a long time CQ / AEM backend developer I ran into some issues
>>>>>> to adjust to Sling.
>>>>>>
>>>>>> I have a resource ‘Home Page’ that should render a JCR node as
>>>>>> a HTML page. The Home page component then only adjust
>>>>>> the layout of the Body and Head and the rest should be inherited from
>>>>>> its Resource Super Type “Page’. I tried that but it does not render
>>>>>> without the home.html as well as the footer missing in Home is not
>>>>>> picked up.
>>>>>>
>>>>>> This is my configuration:
>>>>>>
>>>>>> 1. JCR Content Node (/content/sample/home)
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>>     jcr:primaryType="nt:unstructured"
>>>>>>     jcr:title="Sample Home"
>>>>>>     jcr:description="Sample Home Page"
>>>>>>     sling:resourceType="sample/home"
>>>>>>     sling:resourceSuperType="sample"
>>>>>> />
>>>>>>
>>>>>> 2. Home Page configuration (/apps/sample/home):
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>>     jcr:primaryType="sling:Folder"
>>>>>>     jcr:title="Sample Home Page Component"
>>>>>>     jcr:description="Sample Home Page Component woth HTL"
>>>>>>     sling:resourceSuperType="sample/page"
>>>>>> />
>>>>>>
>>>>>> This only contains the head.html and body.html file.
>>>>>>
>>>>>> 3. Page Configuration (/apps/sample/page):
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>>     jcr:primaryType="sling:Folder"
>>>>>>     jcr:title="Sample Page Component"
>>>>>>     jcr:description="Sample Page Component"
>>>>>> />
>>>>>>
>>>>>> This contains the page.html which includes the head, body and footer.html file.
>>>>>>
>>>>>> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>>>>>>
>>>>>> Any way to make the work like in AEM?
>>>>>>
>>>>>> I am pretty sure that I don’t see the forest because of the trees here
>>>>>> but I could not figure out how to do it right even when looking at the
>>>>>> Sling Samples.
>>>>>>
>>>>>> Thanks - Andy Schaefer
>>>>>
>>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Sling Resource Rendering Inheritance

Roy Teeuwen
Hey Andreas,

My approach here is the following:

Libs is for libraries that enhance Sling => Composum is a library that is meant to be used to enhance Sling. They also give the benefit that when you package your library/module and let other developers use it, they can extend/override the actual libraries, like composum, by placing stuff under /apps/composum without having to actually change the code of the library itself in the /libs folder

Apps is for projects that use sling => A website for example. A website will normally not be extended, seeing as it is your own website, and you won't distribute that code to other developers for other projects.

I think for the most part this holds true.

Greets,
Roy

> On 23 Mar 2017, at 17:31, Andreas Schaefer Sr. <[hidden email]> wrote:
>
> Hi Roy
>
> Thanks for all your help.
>
> At the end it turns out that I made a mistake when using the HTL include:
>
> This was my first include:
>
>    <sly data-sly-include="head.html"/>
>
> which fails. But using this:
>
>    <sly data-sly-include="${'head.html'}"/>
>
> does work.
>
> So on another node I saw some Sling apps (samples and Composum) that place
> their components under /libs instead of /apps.
>
> In AEM developers were told not to put anything under /libs and now Sling it going
> the other way. Is there a reason for this shift. As far as I know there’s no difference.
>
> Thanks for all your help - Andy
>
>> On Mar 23, 2017, at 12:30 AM, Roy Teeuwen <[hidden email]> wrote:
>>
>> Hey Andreas,
>>
>> I am not sure why it is not working for you that way, but that should definitely still work, there is no dependency whatsoever to a folder being named "components", see my next examples:
>>
>> page-example-2.zip: I moved everything right under /apps/idoneus, no /components => still works
>> page-example-3.zip: I moved everything to under /libs/idoneus => still works
>>
>> https://www.dropbox.com/s/3d64tqd62wb81n9/page-example-2.zip?dl=1 <https://www.dropbox.com/s/3d64tqd62wb81n9/page-example-2.zip?dl=1>
>> https://www.dropbox.com/s/tw0edw4dddi9ksh/page-example-3.zip?dl=1 <https://www.dropbox.com/s/tw0edw4dddi9ksh/page-example-3.zip?dl=1>
>>
>> Greets,
>> Roy
>>
>>> On 22 Mar 2017, at 19:48, Andreas Schaefer Sr. <[hidden email] <mailto:[hidden email]>> wrote:
>>>
>>> Yeah, the have a big “Download Now” button and that is not the file.
>>> I think the reason was that I use Safari w/o Flash and then the link won’t show.
>>>
>>> That said your code words and the major difference I saw is that the inheritance
>>> only works if it is in the /apps/<project folder name>/components folder. I tried
>>> that after I got mine working by copying the working resource type definitions back
>>> up to /apps/<project folder name>.
>>>
>>> This structure works:
>>>
>>> /apps
>>> /testApps
>>> /components
>>> /home
>>> body.html
>>> /page
>>> body.html
>>> page.html
>>>
>>> The page.html has a HTL import of body.html and it will take the one from actual
>>> resource type (here testApps/components/home).
>>>
>>> Can anyone from the sling team verify that? If so why, where is that defined and
>>> is that configurable?
>>>
>>> I used the sling sample Fling as an example but that does not use inheritance.
>>>
>>> Thanks for you swift help - Andy Schaefer
>>>
>>>> On Mar 22, 2017, at 11:05 AM, Roy Teeuwen <[hidden email] <mailto:[hidden email]>> wrote:
>>>>
>>>> Hey Andreas,
>>>>
>>>> Huh, I think you pushed the advertisement button or something, or maybe you have to click twice. Anyway, here, my dropbox:
>>>>
>>>> https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1 <https://www.dropbox.com/s/0sem7twkr5a2icp/page-example-1.zip?dl=1>
>>>>
>>>> Greetings,
>>>> Roy
>>>>> On 22 Mar 2017, at 18:26, Andreas Schaefer <[hidden email]> wrote:
>>>>>
>>>>> Hi Roy
>>>>>
>>>>> I tried to download your example but I am not going to install
>>>>> an Installer software just to see a ZIP file.
>>>>>
>>>>> Can you share this file by any other means?
>>>>>
>>>>> Thanks - Andy Schaefer
>>>>>
>>>>>> On Mar 21, 2017, at 9:52 PM, Roy Teeuwen <[hidden email]> wrote:
>>>>>>
>>>>>> Hey Andreas,
>>>>>>
>>>>>> I made an example package in sling-9, you can use composum to install the package.
>>>>>>
>>>>>> http://www12.zippyshare.com/v/nWrL1Azm/file.html
>>>>>>
>>>>>> It works for me, I made the following:
>>>>>>
>>>>>> /apps/idoneus/components/page => contains page.html and header.html which does a data-sly-include of header.html
>>>>>> /apps/idoneus/components/home => supertype is page, and overwrites the header.html
>>>>>> /content/idoneus/en => is a homepage, you can see that the header now says "Header home page"
>>>>>> /content/indoneus/en/test-page => is a normal page, has as header "Header base page"
>>>>>>
>>>>>> Can you verify the package and maybe share what is different, so that it also gets typed textual on the mailing list for future reference
>>>>>>
>>>>>> Greets,
>>>>>> Roy
>>>>>>
>>>>>>
>>>>>>
>>>>>>> On 21 Mar 2017, at 20:18, Andreas Schaefer <[hidden email]> wrote:
>>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> As a long time CQ / AEM backend developer I ran into some issues
>>>>>>> to adjust to Sling.
>>>>>>>
>>>>>>> I have a resource ‘Home Page’ that should render a JCR node as
>>>>>>> a HTML page. The Home page component then only adjust
>>>>>>> the layout of the Body and Head and the rest should be inherited from
>>>>>>> its Resource Super Type “Page’. I tried that but it does not render
>>>>>>> without the home.html as well as the footer missing in Home is not
>>>>>>> picked up.
>>>>>>>
>>>>>>> This is my configuration:
>>>>>>>
>>>>>>> 1. JCR Content Node (/content/sample/home)
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>>>    jcr:primaryType="nt:unstructured"
>>>>>>>    jcr:title="Sample Home"
>>>>>>>    jcr:description="Sample Home Page"
>>>>>>>    sling:resourceType="sample/home"
>>>>>>>    sling:resourceSuperType="sample"
>>>>>>> />
>>>>>>>
>>>>>>> 2. Home Page configuration (/apps/sample/home):
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>>>    jcr:primaryType="sling:Folder"
>>>>>>>    jcr:title="Sample Home Page Component"
>>>>>>>    jcr:description="Sample Home Page Component woth HTL"
>>>>>>>    sling:resourceSuperType="sample/page"
>>>>>>> />
>>>>>>>
>>>>>>> This only contains the head.html and body.html file.
>>>>>>>
>>>>>>> 3. Page Configuration (/apps/sample/page):
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0 <http://www.jcp.org/jcr/1.0>" xmlns:nt="http://www.jcp.org/jcr/nt/1.0 <http://www.jcp.org/jcr/nt/1.0>" xmlns:sling="http://sling.apache.org/jcr/sling/1.0 <http://sling.apache.org/jcr/sling/1.0>"
>>>>>>>    jcr:primaryType="sling:Folder"
>>>>>>>    jcr:title="Sample Page Component"
>>>>>>>    jcr:description="Sample Page Component"
>>>>>>> />
>>>>>>>
>>>>>>> This contains the page.html which includes the head, body and footer.html file.
>>>>>>>
>>>>>>> This setup does not work and I could only make it work by providing the /apps/sample/home/home.html.
>>>>>>>
>>>>>>> Any way to make the work like in AEM?
>>>>>>>
>>>>>>> I am pretty sure that I don’t see the forest because of the trees here
>>>>>>> but I could not figure out how to do it right even when looking at the
>>>>>>> Sling Samples.
>>>>>>>
>>>>>>> Thanks - Andy Schaefer
>>>>>>
>>>>>
>>>>
>>>
>>
>


signature.asc (817 bytes) Download Attachment