Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Add superscript tag dynamically

Avatar

Level 4

All, I have a problem statement where webhe have supposed to show ® as superscript.But this has not been aded by content author so now am trying to update dynamically . Is there any suggested approach

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@samr99530769, you can inject this XML block into your touchUI cq_dialog.xml

<subsuperscript
   jcr:primaryType="nt:unstructured"
   features="*"/>

Full list of richText options can be found here, https://gist.github.com/briankasingli/1a7e3e12deaa2e076645b09d30039b46

 

View solution in original post

4 Replies

Avatar

Employee Advisor

@samr99530769  To update the content programmatically, you can create a custom servlet which can take content path as input and then using QueryBuilder/ QueryManger find all the nodes under the specified path that contains the character to be superscripted.

Iterate through the list of nodes and parse the "text" property and update the property adding <sup> </sup> tags around the character using string operations. Save the node and replicate if needed.

Query would be something like this: SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/<your-site-path>]) and CONTAINS(s.*, '<string to be superscripted>')

Avatar

Community Advisor

Superscript is a plugin that is available in RTE. You can enable and author it as per your requirement.

 

Advantages:

Authoring activity

No code changes

One time activity

No technical knowledge needed

 

Disadvantages:

Time-consuming

 

Reference: https://experienceleague.adobe.com/docs/experience-manager-65/administering/operations/rich-text-edi...

 

If you want to add it programmatically, you need to search the nodes that need the tag to be added and update the node.

 

Pros:

Less time consuming

 

Cons:

Depending upon the content, the updation might take time and might impact the server performance

As this is one-time activity (hopefully) the code is useless next time

 

Thanks,

Kiran Vedantam

Avatar

Employee

Hi @samr99530769

You can install the package that contains a Touch UI component that uses the RTE including superscript tag plugin as described in below documentation link. 

 

More details at:

https://helpx.adobe.com/experience-manager/using/touchUI_RTE_configure.html#:~:text=You%20can%20crea...

 

Thanks!!

Avatar

Correct answer by
Community Advisor

@samr99530769, you can inject this XML block into your touchUI cq_dialog.xml

<subsuperscript
   jcr:primaryType="nt:unstructured"
   features="*"/>

Full list of richText options can be found here, https://gist.github.com/briankasingli/1a7e3e12deaa2e076645b09d30039b46