Expand my Community achievements bar.

SOLVED

Extending Comments Component (Issue adding comments)

Avatar

Community Advisor

Hello All,

I am trying to extend the comments component. I used the sample package available on this link. After installing the package I am able to make comments from publish side. But this seems to happen only if I drop the component, but if I include the component in my custom site's page jsp, the component is not rendered fine. I compared the node structure and it matches with one mentioned on this link. After I drop same custom comments component on same page, the included custom component also starts working fine. I am also adding the 'Client Libs List' component so that the JS works fine. I have attached images showing how the components look when included and when DnD'd and included (The CSS was disabled).

If anyone has extended the comments component into a custom project and might know the cause of issue please let me know..

Thanks :)

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Thanks JK,

I included the second just to see whether I see the same behavior, and even if I do not include the component and just drop it in parsys, it works fine. I also included the client library 

<cq:includeClientLib categories="cq.social.hbs.comments" />

Had the above, added in template jsp where the comments component was added.

 

On checking the node structure following change fixed my issue

My comments component was being added to an existing content which was having a custom node for comments (project-custom) component. The node name was something like 'my_comment' with resourceType pointing to the comments component.

While doing cq:include I changed to 

<cq:include path="my_comments" resourceType="/apps/project/components/my/my_comments" />
from --> <cq:include path="comments" resourceType="/apps/project/components/my/my_comments" />

 

So earlier I had two nodes 'my_comment' doing nothing and 'comments' node supposed to display the component. Now I just have 'my_comments' node that points to the component and shows the component content as well...Hope that helps someone..

Best Regards

View solution in original post

3 Replies

Avatar

Level 9

Hi,

First, you cannot have two comment systems on the same page.

Second, when including the component, did you also include the client library?

- JK

Avatar

Correct answer by
Community Advisor

Thanks JK,

I included the second just to see whether I see the same behavior, and even if I do not include the component and just drop it in parsys, it works fine. I also included the client library 

<cq:includeClientLib categories="cq.social.hbs.comments" />

Had the above, added in template jsp where the comments component was added.

 

On checking the node structure following change fixed my issue

My comments component was being added to an existing content which was having a custom node for comments (project-custom) component. The node name was something like 'my_comment' with resourceType pointing to the comments component.

While doing cq:include I changed to 

<cq:include path="my_comments" resourceType="/apps/project/components/my/my_comments" />
from --> <cq:include path="comments" resourceType="/apps/project/components/my/my_comments" />

 

So earlier I had two nodes 'my_comment' doing nothing and 'comments' node supposed to display the component. Now I just have 'my_comments' node that points to the component and shows the component content as well...Hope that helps someone..

Best Regards

Avatar

Level 9

Hi,

I'm glad you found the solution.

Thank You! for returning to inform the community of what you found.

I'll add this to a task list for improving the tutorial.

- JK