Hi All,
I am trying to add custom action to sidekick, for which I want to get the url suffix. Any idea how this can be done.
Also will this work when we have some etc mapping for our urls?
Thanks!
Shehjad
Solved! Go to Solution.
Views
Replies
Total Likes
Its all playing with JS. You can manipulated alot with JS, if you are hitting at right area.
1st Part ...
CQ.WCM.getPagePath(); will give you current page path
Get the last part the page like this...
x = "/a/b/c/d";
y = x.substring(x.lastIndexOf("/");
y will be "/b" which in you case will be item code.
2nd part
You can sent a GET request to /etc/map/http.1.json to get json response.
Thats it...
Pass the full path which you want to give as a hyperlink to CQ.shared.Util.open(url);
Refer to the above shared article for help.....its talks about all this.......
Views
Replies
Total Likes
Hi Shehjad,
Here is the similar use case implemented, It adds a button and onclick it opens a url.
http://adobeaemclub.com/customize-aem-sidekick-add-useful-feature/
Can you tell me, which suffix you are trying to get
Views
Replies
Total Likes
Hi Praveen,
My actual URL is like /content/site/en/products.html/item-12 . Where item-12 is code of my product.
But we also want to apply etc mapping on this and thus it might render on browser like /products.item-12.html. I want to write a code to get my product code on click of button in such a way that it works both with mapping and without mapping.
Thanks!
Shehjad
Views
Replies
Total Likes
Its all playing with JS. You can manipulated alot with JS, if you are hitting at right area.
1st Part ...
CQ.WCM.getPagePath(); will give you current page path
Get the last part the page like this...
x = "/a/b/c/d";
y = x.substring(x.lastIndexOf("/");
y will be "/b" which in you case will be item code.
2nd part
You can sent a GET request to /etc/map/http.1.json to get json response.
Thats it...
Pass the full path which you want to give as a hyperlink to CQ.shared.Util.open(url);
Refer to the above shared article for help.....its talks about all this.......
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies