<div class="text" > <cq:include path="bodytext" resourceType="foundation/components/text"/> </div>
I am embedding foundation components in a page component (see the following) and need to set some default content. How do I go about this?
Solved! Go to Solution.
Use the page template. Add the components that you want to be on the page below the /app/myapp/templates/mypagetemplate/jcr:content node, and also add the content to the components.
See the page template of the geometrixx-outdoors sample: /apps/geometrixx-outdoors/templates/page/jcr:content/par/title
Edit; Here is another way to do it, which might be easier for authoring the content: http://dev.day.com/docs/en/cq/current/developing/boilerplates.html
hope that helps,
scott
Views
Replies
Total Likes
Use the page template. Add the components that you want to be on the page below the /app/myapp/templates/mypagetemplate/jcr:content node, and also add the content to the components.
See the page template of the geometrixx-outdoors sample: /apps/geometrixx-outdoors/templates/page/jcr:content/par/title
Edit; Here is another way to do it, which might be easier for authoring the content: http://dev.day.com/docs/en/cq/current/developing/boilerplates.html
hope that helps,
scott
Views
Replies
Total Likes
Can you please elaborate on what you are trying to do. Are you asking how to set default components on a page. You can configure the page to use paragraph system and then an author can drag and drop components from the side kick to a page.
<%@include file=
"/libs/foundation/global.jsp"
%>
<cq:include script=
"/libs/wcm/core/components/init/init.jsp"
/>
<html>
<head>
<title>AEM Twitter Feed Page</title>
</head>
<body>
<h2>This page displays twitter feeds</h2>
<cq:include path=
"par"
resourceType=
"foundation/components/parsys"
/>
</body>
</html>
Views
Replies
Total Likes
Thanks, Scott. This is not directly related to what I want to do, but I had not seen the boiler plate option before. I can push default components on page as you suggest or directly embedded in the template jsp. The issue is adding default content for a given cq:include. It would be best to have an attribute that allows direct injection of the placeholder text and even better we would have a reference attribute that could pull content from a /content node. Where do we add such requests?
No, I am doing this with the snippet above. I am trying to setup "placeholder" or default text on the text component I have setup already on the page.
Views
Replies
Total Likes
Ah ok I think I misunderstood your original question (sorry). I'm not sure you can do that in a good way without a custom component because the jcr node for the component needs to be created before you can add the content. (please, somebody correct me if I'm wrong)
If you know the location of the node that is created (approximately) you could use a workflow and a launcher to inject the content after the node is created
scott
Views
Replies
Total Likes
Just extend the text component and set the default text. All components in CQ can be extended. For information, see:
http://dev.day.com/docs/en/cq/current/developing/widgets.html
Views
Replies
Total Likes
No worries.
It was seem like if you had some content or a reference in a cq:include tag then that would server as a parameter in the instantiation of the component instance.
eg.
<cq:include path="bodytext" resourceType="foundation/components/text"/ placeHolder="/content/placeholder-1">
Views
Replies
Total Likes
Thanks, but we should not have to extend a component every time we want some default text. This is is not conducive to author experience. What other alternatives are there?
Views
Replies
Total Likes
You can either extend the component or modify the text component itself. However, modifying the text component is not really recommended. Its better practice to make a copy, modify the copy (set the default text) and use that. See this topic "DEVELOPING A NEW COMPONENT BY ADAPTING AN EXISTING COMPONENT"
located here:
http://dev.day.com/docs/en/cq/current/getting_started/first_steps_for_developers.html
Once you create the new component, you can add it to the sidekick. An author would drag it from the sidekick and then see the default text. An author would never create a component -- this is a developer task.
Views
Replies
Total Likes
Views
Likes
Replies