Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

how to have custom content on my custom template (included via data-sly-include)?

Avatar

Level 8

So I have the following HTL code that includes section templates

<section>

    <sly data-sly-resource="/content/config/header"></sly>

</section>

<section>

    <sly data-sly-resource="/content/config/section1"></sly>

</section>

<section>

    <sly data-sly-resource="/content/config/section2"></sly>

</section>

<section>

    <sly data-sly-resource="/content/config/footer"></sly>

</section>

I created a new page using this template and it seems to be working fine. My issue is that changes I made on my page are reflected the original file.

example:

On the section2 part (inside the page I created using the template as base), I added a new RTE for my custom content. When I opened /content/config/section2, my RTE is there. Is there a way to prevent this? or perhaps a workaround?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Are you using Editable template or static templates?

Assuming you used an Editable template, when you make a change in the editable template - for example, lets say you changed a policy and added new components to that policy, you need to add the new component at the page level in order for the component to show up in the page.

"The issue is that when I want to customize the content (in my example, section2) on my page. The changes are reflected on my template so any pages using it gets the changes."

When you create a page based on an editable template, and then you add components to that page (that are allowed via the policy), the Editable Template is not modified. You cannot modify a template by adding content to a page that is based on that template.

Here:

Editable Template A -> Page 1 (based on template A).

Author opens Page 1 and makes changes.

Template A is not impacted in any way when the author makes changes to Page 1.

View solution in original post

3 Replies

Avatar

Administrator

I am not very clear with your question here.

But i would recommend you to use Template Editor​ .

Here you can set the Initial content for the pages that are created with a particular template. Also, you can control what all components to allow within the page..

I am not very clear if you want changes made in the templates to be reflected to the pages or not?

-Kautuk



Kautuk Sahni

Avatar

Level 8

Please refer to this screenshot.

I've created a custom template that shows up when I want to create a new page. We're using the template so that all content authors wll have a base when writing content.

As a I said above, the issue is that I can create a new page using the template without any issues. The issue is that when I want to customize the content (in my example, section2) on my page. The changes are reflected on my template so any pages using it gets the changes.

I want to be able to customize content just on my page.

Any ideas how this can be done?

Screen Shot 2018-02-06 at 8.31.28 am.png

Avatar

Correct answer by
Level 10

Are you using Editable template or static templates?

Assuming you used an Editable template, when you make a change in the editable template - for example, lets say you changed a policy and added new components to that policy, you need to add the new component at the page level in order for the component to show up in the page.

"The issue is that when I want to customize the content (in my example, section2) on my page. The changes are reflected on my template so any pages using it gets the changes."

When you create a page based on an editable template, and then you add components to that page (that are allowed via the policy), the Editable Template is not modified. You cannot modify a template by adding content to a page that is based on that template.

Here:

Editable Template A -> Page 1 (based on template A).

Author opens Page 1 and makes changes.

Template A is not impacted in any way when the author makes changes to Page 1.