Creating a canonical URL within the content editor

Hi-

I currently have a canonical URL being generated in assembly. I would like to move this into the content type in a read-only field so that the users can see the result and change the meta data accordingly if necessary. Do you have any recommendations on how to do this within the content editor?

Here is my code from the assembly piece:


#set($contentType = $sys.item.getDefinition().getLabel())
#set($scrubbed = $user.bcurlutils.getScrubbedTitle($sys.item.getProperty("rx:displayTitle").String))
#set($prefix = $user.bcurlutils.getKeywordValue("BC_Artifact_Prefix",$contentType))
#set($suffix = $user.bcurlutils.getKeywordFlagValue("BC_Url_Suffix", $sys.item.getProperty("isParentCenter")))
#set($url = $user.bcurlutils.getCanonicalUrl("BC_Artifact_Prefix",$contentType,$sys.item.getProperty("displayTitle").String, $sys.item.getProperty("legacyId").String, "BC_Url_Suffix", $sys.item.getProperty("isParentCenter")))


Sharyn,

This is going to be hard to do in a content editor: there is no “assembly context” to run Velocity (and JEXL) against.

The simplest approach thing to do is probably to build a small assembly template that returns the info that you want as XML, and then build a custom control that uses the XSL document() function to pull in the the assembly data.

I think it’s better to take this approach than to actually store the result in a read-only field, unless you also need this for Search or something. If you just want the users to see the results, you don’t actually need it saved in the back end.

Dave