この会話は、活動がないためロックされています。新しい投稿を作成してください。
この会話は、活動がないためロックされています。新しい投稿を作成してください。
Hi all,
From one javascript file I am receiving the following array:
tags ["parenttag:tag1/subtag1", "parenttag:tag1/subtag2", "parenttag:tag1/subtag3", "parenttag:tag2/subtag4", "parenttag:tag2/subtag5"]
I would need to get each tag title from these values. E.g from "parenttag:tag1/subtag1" the tag title is defined as "Subtag 1"
Is there any way of doing this from javascript?
Thank you.
表示
返信
いいね!の合計
Hi
Let say:
Var a = ["parenttag:tag1/subtag1", "parenttag:tag1/subtag2", "parenttag:tag1/subtag3", "parenttag:tag2/subtag4", "parenttag:tag2/subtag5"];
So ,
a[0] would print :- "parenttag:tag1/subtag1"
a.length := 5
and
Var result = a[0].split("/");
result would be :- ["parenttag:tag1", "subtag1"]
and result[1] would give you:- "subtag1"
Now repeat this in a for loop from 1 to a.length
I hope this would help you.
Thanks and Regards
Kautuk Sahni
表示
返信
いいね!の合計
Hi kautuksahni,
thanks for you help but I am afraid that does not work for me, as I could have "parenttag:tag1/subtag1" which its actual title could be "Little Kitties"
Is any CQ object I can call from the front end to get this value? or any other way/workaround to do so?
表示
返信
いいね!の合計
AFAIK, there is no OOTB direct way to resolve the tag and get the title in JS
But you might want to look into the code of tagpicker field in TOUCH UI and one option can be a servlet where you can pass Id's in one go and get all title
Thanks
表示
返信
いいね!の合計
Trying to read the DOM to get tags information is not best practice.
There are much better ways to get Tag in AEM via the Tag Manager API. See these articles:
Developing a Sightly Component that searches for AEM Content Tags
Using Custom Tag Libraries to search for AEM Content Tag
Hope these help
表示
返信
いいね!の合計
you can do like this, it's very simple,
$.ajax({
type: "GET",
url: "/etc/tags/TestTag/"+Tagid+".json", //
success : function(data) {
TagTitle= data["jcr:title"];
}
});
表示
返信
いいね!の合計
No, I don't think it's simple.
1. Direct URL could be blocked via dispatcher.
2. By default, Anonymous user does not have tags permission. https://docs.adobe.com/docs/en/aem/6-2/administer/content/tags.html#Setting Tag Permissions
Thanks
表示
返信
いいね!の合計
Hi,
Can you please publish the updated links, as the below ones are not available anymore
Developing a Sightly Component that searches for AEM Content Tags
表示
返信
いいね!の合計