Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Sibling node name id and identifying them in path browser

Avatar

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
RonakB
Level 2

10-10-2018

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

Replies

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

10-10-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 

Avatar

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
RonakB
Level 2

11-10-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.

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

12-10-2018

Hi,

Yes, it is there for that but AEM uses nameHint parameter to create name while we drag and drop components.

We can easily overwrite this nameHint parameter using sling Filter but I'll check other option to overwrite nameHint this option and get back to you.

Algorithm for Node Name Creation

If request is posted with an URL ending in slash / or slash-star /*, the SlingPostServlet derives a name for the node to be created upon the request applying the following algorithm:

  1. If a :name parameter is supplied, the (first) value of this parameter is used unmodified as the name for the new node. If the name is illegally formed with respect to JCR name requirements, an exception will be thrown when trying to create the node. The assumption with the :name parameter is, that the caller knows what he (or she) is supplying and should get the exact result if possible.
  2. Otherwise if a :nameHint parameter is supplied, the (first) value of this parameter is used to generate the node name. A name filtering is applied to this hint to ensure a valid JCR node name.
  3. Otherwise a series of request parameters supplied to set content is inspected for a possible name. The list of the names of these parameter is configurable with the SlingPostServlet and defaults to title, jcr:title, name, description, jcr:description, abstract. The first request parameter with a non-empty value is used and filtered to get the valid JCR name.
  4. Otherwise an ever increasing auto generated number is used. Filtering is also applied to this numeric name.

Avatar

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
RonakB
Level 2

14-10-2018

Thanks for your time Arun. Yes, I was referring to this link only. It would be great if you can elaborate the options to overwrite nameHint.

Avatar

Avatar
Validate 25
MVP
PuzanovsP
MVP

Likes

140 likes

Total Posts

543 posts

Correct Reply

165 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Contributor 2
Ignite 10
View profile

Avatar
Validate 25
MVP
PuzanovsP
MVP

Likes

140 likes

Total Posts

543 posts

Correct Reply

165 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Contributor 2
Ignite 10
View profile
PuzanovsP
MVP

15-10-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

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

15-10-2018

Whats the purpose of "when content author tries to reference any of those 4-5 instances created in another page using path browser,"

This does not sound like best practice at all. There should be no need to an author to reference an image component -- for example - located in another page.

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,358 likes

Total Posts

3,228 posts

Correct Reply

918 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

15-10-2018

I agree with Scott. If I need to reuse/reference the same content, I would probably go with either content fragment or experience fragments.

Avatar

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
RonakB
Level 2

15-10-2018

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 ?

Avatar

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 1
Level 2
RonakB
Level 2

Likes

6 likes

Total Posts

41 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 1
Give Back 5
View profile
RonakB
Level 2

15-10-2018

The idea is to create a page under something like /content/mysite/global/ and author all the required instances of that component under that. Then in the product specific pages, simply use reference to this.

We thought to go with content fragment but faced below challenges.

1. This is not a single field reference. It is a mini component with textfield, RTE and pathbrowser in turn. So we though to use CFM but faced limitations.

2. Also, we are on SP2 CF1 right now where CFM is disabled for some reason because of the CFP we have added.

Hence, we thought to create a custom component and reference it.