Sibling node name id and identifying them in path browser | Community
Skip to main content
Level 3
October 11, 2018

Sibling node name id and identifying them in path browser

  • October 11, 2018
  • 3 replies
  • 9576 views

Hi All,

When same component is used more than one time under same parsys, it is created using unique id like mycomponent_1526332 and so on.

Now when content author tries to reference any of those 4-5 instances created in another page using path browser, they can not differentiate between them as it shows like mycompnent_1234433, mycompnent_3243555 etc.

Question is :

1. Is it possible to control how this ID is created when node is created and we can give more meaningful name like mycomponent_01, mycomponent_02 ?

2. Is it possible to display some meaningful name in the path browser other than node name (which is only possible to know using crx/de access) ?

I am using AEM 6.3 SP2 CF1

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

3 replies

arunpatidar
Community Advisor
Community Advisor
October 11, 2018

Hi,

You can do this using JCR APIs, as soon as you drop your component, a node is created in repository, you can listen CREATE event and rename the node name.

You can either use sling or JCR events

Event (Content Repository for Java Technology API Version 2.0)

Creating an AEM JCR Event Listener using a Maven Archetype 12 Project 

Arun Patidar
RonakBAuthor
Level 3
October 11, 2018

Thanks Arun for your reply. I had thought of Listener. But just don't want to add listener which will trigger it for all the requests of Node Creation throughout my multi tenant instance (I know I can request based on Path / resource type etc - but that will still come to the listener at least ones) .

I was looking for rather elegant way where it triggers only for the component I want it by adding some properties / adding :name parameter for Post Servlet / adding some mixins if possible. 

I heard about Post Servlet :name parameter but not sure how to use it when the component is dragged for the first time in parsys. This will be safer option as it will trigger use the :name param where passed and do the usual node naming else where.

Hope I am making the point clear.

RonakBAuthor
Level 3
October 15, 2018

Hi Ronak,

You are about to start tingling with how AEM OOTB granite UI is about to tell AEM to store data. That's probably, not the best idea in the history of AEM.

What could be better is to improve pathfinder/extend pathfinder, and bring in some rendering options(UI options) for your content authors. This functionality was partially there for classic UI, but got lost, not implemented in Touch UI.

Instead of modifying how back end stores data, make a nice presentation for your pathfinder to let content author know what they are about to choose.


Regards,Peter


Thanks Peter. So we are talking about overriding path browser component rather than looking at how the nodes are created. when you say nice presentation, what is your idea ? Are you saying to try to display component title / some other field instead of node name ?

raj_mandalapu
Level 7
October 16, 2018

If you are authoring all common components on this page /content/mysite/global/  and referring authored components on other pages then I feel we can use EventListener I know you guys have already discussed on this but based on the below assumptions I feel it is a good approach for this requirement because

As per my understanding, we are going to author components only on the global page and I feel for every website there would be only one global page. if this is the case then we can configure to execute listener for the only global page. I don't see much performance impact here and also we need to execute listener only when the node is created and for other operations, we do not need to execute. I think you need to consider below things also when we choose listener how frequently you are going to delete and add components. as these are common components so I feel there would be less number of delete and add operations. if you think the operations are heavy also I prefer Listener as I am going to execute this only on the author not on publish. I don't know why are we avoiding Listeners here. correct me If I am wrong

smacdonald2008
Level 10
October 16, 2018

Raja - nice answer. For ppl reading this - Adobe still recommended using components in a page as described in this online tutorial - Getting Started with AEM Sites - WKND Tutorial . Use editable templates and then in each editable template - define a Policy that lets authors have access to a set of components. Then at the page level - authors drag and drop components onto a page and set the component properties via a Touch UI component dialog - that reflects best practice.

Furthermore - for code reuse - you can use experience fragments too within pages based on editable templates.

raj_mandalapu
Level 7
October 17, 2018

I always prefer KISS policy instead of making things complex, I do not like overwriting nameHint param for a simple requirement if you find any solution on nameHitn param, request you please share with us. fine-tuned way means in terms of what  ? are you expecting on performance ?  or maintenance? or something else?