Automatically Create Node w/ Properties for Embedded Component | Community
Skip to main content
Level 3
October 16, 2015
Solved

Automatically Create Node w/ Properties for Embedded Component

  • October 16, 2015
  • 5 replies
  • 1749 views

We're creating a "form-like" interface in the authoring environment and will be developing several components that are embedded with cq:include into the template. Is there any way to auto-generate those nodes when a new page is created and supply those nodes with default properties? We could do it programmatically in each component but wanted to see if CQ had any built in functionality i was missing. Ex -

With this in our template -

<cq:include path="pageContent/discountOverview" resourceType="/apps/site/components/discountOverview"/>

We'd want to see this node when page is created -
/content/site/../pagetitle/jcr:content/pageContent/discountOverview

 

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

When you want to have some components by default on a page, you can create them directly below the template node. When you create a page, the template node (plus all subnodes) is copied to the position of the page you create.

cheers,
Jörg

5 replies

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

When you want to have some components by default on a page, you can create them directly below the template node. When you create a page, the template node (plus all subnodes) is copied to the position of the page you create.

cheers,
Jörg

Lokesh_Shivalingaiah
Level 10
October 16, 2015

When you include that as part of your template, it by default will be part of a page when its created.

jocampAuthor
Level 3
October 16, 2015

Of course, i was trying to figure it out at a component level but it makes sense that it would happen at the template level. Thank you

Dinu_Arya
Level 6
October 16, 2015

Nice trick Feike. Thanks.