user1182504
user1182504

Reputation:

CQ parsys component persists on the page

I added a single parsys component in my template using the code:

<div class = "BodyText" style="margin-top:75px;" >
  <cq:include path="vff1" resourceType="foundation/components/parsys"/>
  </div> 

But when I create a page, and add some text to the parsys component, the component still stays on the page (below the text I added).

Is there a way to remove it after adding some asset (text or image etc.)in to the parsys ?

Upvotes: 2

Views: 5419

Answers (4)

user2952937
user2952937

Reputation: 21

There is a way to remove the parsys, but I would advice to exercise this with caution. First in your include parsys you check if the component you want to add into this particular parsys exist or not. If it does than you just directly include in that component into your page, and if not then you include the parsys.

Sample code:

<c:choose>
<c:when test="<COMPONENT_EXIST>">
   <cq:include path="<Path to component>" resourceType="<component resource>" />
</c:when>

<c:otherwise>
   <cq:include path="<parsys_path>" resourceType="foundation/components/parsys" />
</c:otherwise>
</c:choose>

Upvotes: 0

Riju Mahna
Riju Mahna

Reputation: 6926

Agree with the answers given above. The correct answer will be just to summarize the above 2 answers.

  1. The parsys component can't be just removed after adding components into it. If you don't want it, then add the desired component ins the jsp of the page. (Not recommended at all)
  2. It is anyways visible only in the 'author' instance. The dotted-bordered component that displays 'Drag components or assets here' won't appear in the 'public' instance.

Upvotes: 1

raja vijay singh
raja vijay singh

Reputation: 141

To add, the drop area appears only in author mode, if you want to check how it looks in publish mode you can select the preview mode in the sidekick. As such your publish site will be the live site in production

Upvotes: 2

kfaerber
kfaerber

Reputation: 1327

The parsys is a drop area for components. You cannot drop components into the parsys then remove the parsys without also removing the components contained inside as the components are sub-nodes of the parsys node in the jcr.

In your case it seems that you would prefer to embed the text component into the template instead of the parsys

<div class="BodyText" style="margin-top:75px;">
    <cq:include path="text" resourceType="foundation/components/text"/>
</div>

Remember the path attribute needs to be unique.

Upvotes: 3

Related Questions